text: (this.webpackJsonpdenver=this.webpackJsonpdenver||[]).push([[0],[,,,,,,,,,,,,function(t,e,n){},function(t,e,n){},,function(t,e,n){},function(t,e,n){},function(t,e,n){"use strict";n.r(e);var o=n(1),s=n.n(o),i=n(7),c=n.n(i),a=(n(12),n(2)),r=n(3),l=n(5),u=n(4),d=(n(13),n(0)),h=function(t){Object(l.a)(n,t);var e=Object(u.a)(n);function n(t){var o;return Object(a.a)(this,n),(o=e.call(this,t)).showHide=function(t,e){document.getElementById(t).style.display=e?"block":"none"},o.showHides=function(){var t="undefined"===this.state.global.accessToken;this.showHide("login",t),this.showHide(this.props.mainId,!t)},o.login=function(){var t=this,e=document.getElementById("username").value,n=document.getElementById("password").value,o={method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"username=".concat(e,"&password=").concat(n)};fetch("".concat(this.state.global.baseUri,"/login"),o).then((function(e){t.putToken(e)}),(function(t){document.getElementById("login-error").innerHTML=t.message}))},o.putToken=function(t){var e=this;t.ok?t.json().then((function(t){window.global.accessToken="".concat(t.token_type," ").concat(t.access_token),e.showHides()})):t.json().then((function(t){console.log(JSON.stringify(t,null,2)),document.getElementById("login-error").innerHTML="Invalid user credentials!"}))},o.state={global:window.global},o}return Object(r.a)(n,[{key:"render",value:function(){var t=this;return Object(d.jsx)("div",{id:"login",className:"login-form",children:Object(d.jsxs)("fieldset",{className:"login-fieldset",children:[Object(d.jsx)("legend",{className:"login-legend",children:"Authentication:"}),Object(d.jsx)("div",{id:"logo-img",children:Object(d.jsx)("img",{src:"ss-logo.png",alt:"logo"})}),Object(d.jsxs)("div",{children:[Object(d.jsxs)("form",{children:[Object(d.jsx)("div",{className:"login",children:Object(d.jsx)("input",{id:"username",type:"text",size:"30",placeholder:"Username or Email",autoFocus:!0,autoComplete:"on"})}),Object(d.jsx)("div",{className:"login",children:Object(d.jsx)("input",{id:"password",type:"password",size:"30",placeholder:"Password",autoComplete:"on"})}),Object(d.jsx)("div",{className:"login-button",children:Object(d.jsx)("button",{id:"login-btn",type:"button",onClick:function(){return t.login()},children:"Login"})})]}),Object(d.jsx)("div",{children:Object(d.jsx)("p",{id:"login-error",children:"\xa0"})})]})]})})}}]),n}(s.a.Component),b=(n(15),function(t){Object(l.a)(n,t);var e=Object(u.a)(n);function n(t){var o;return Object(a.a)(this,n),(o=e.call(this,t)).getPersons=function(){var t=this;fetch("".concat(this.state.global.baseUri,"/api/persons"),{headers:{Authorization:this.state.global.accessToken}}).then((function(e){t.putData("result",e)}),(function(e){t.putError("result",e)}))},o.getPerson=function(){var t=this,e=this.getData();fetch("".concat(this.state.global.baseUri,"/api/person/").concat(e),{headers:{Authorization:this.state.global.accessToken}}).then((function(e){t.putData("result",e)}),(function(e){t.putError("result",e)}))},o.createPerson=function(){var t=this,e={method:"POST",headers:{"Content-Type":"application/json",Authorization:this.state.global.accessToken},body:this.getData()};fetch("".concat(this.state.global.baseUri,"/api/person"),e).then((function(e){t.putData("result",e)}),(function(e){t.putError("result",e)}))},o.updatePerson=function(){var t=this,e={method:"PUT",headers:{"Content-Type":"application/json",Authorization:this.state.global.accessToken},body:this.getData()};fetch("".concat(this.state.global.baseUri,"/api/person"),e).then((function(e){t.putData("result",e)}),(function(e){t.putError("result",e)}))},o.removePerson=function(){var t=this,e={method:"DELETE",headers:{"Content-Type":"application/json",Authorization:this.state.global.accessToken}},n=this.getData();fetch("".concat(this.state.global.baseUri,"/api/person/").concat(n),e).then((function(e){t.putData("result",e)}),(function(e){t.putError("result",e)}))},o.splunkEvent=function(){var t=this,e={method:"POST",headers:{"Content-Type":"application/json"},body:this.getData()};fetch("".concat(this.state.global.baseUri,"/splunk"),e).then((function(e){t.putData("result",e)}),(function(e){t.putError("result",e)}))},o.getData=function(){return document.getElementById("data").value},o.putData=function(t,e){document.getElementById("status").innerHTML="".concat(e.status," ").concat(e.statusText," ").concat(e.url),document.getElementById(t).style.color=e.ok?"green":"red",e.json().then((function(e){return document.getElementById(t).value=JSON.stringify(e,null,2)}))},o.putError=function(t,e){document.getElementById("status").innerHTML="".concat(e.status," ").concat(e.statusText," ").concat(e.url),document.getElementById(t).style.color="red",document.getElementById(t).value=e.message},o.state={global:window.global},o}return Object(r.a)(n,[{key:"render",value:function(){var t=this;return Object(d.jsxs)("div",{id:"main",className:"center",children:[Object(d.jsx)("h1",{children:this.props.title}),Object(d.jsxs)("fieldset",{className:"main-fieldset",children:[Object(d.jsx)("legend",{className:"main-legend",children:this.props.legend}),Object(d.jsxs)("div",{className:"center",children:[Object(d.jsxs)("div",{id:"buttons",className:"w3-bar",children:[Object(d.jsx)("button",{title:"Get Persons",type:"button",onClick:function(){return t.getPersons()},children:"Persons"}),Object(d.jsx)("button",{title:"Get Person",type:"button",onClick:function(){return t.getPerson()},children:"Person"}),Object(d.jsx)("button",{title:"Create Person",type:"button",onClick:function(){return t.createPerson()},children:"Create"}),Object(d.jsx)("button",{title:"Update Person",type:"button",onClick:function(){return t.updatePerson()},children:"Update"}),Object(d.jsx)("button",{title:"Delete Person",type:"button",onClick:function(){return t.removePerson()},children:"Delete"}),Object(d.jsx)("button",{title:"Ingest Splunk event",type:"button",onClick:function(){return t.splunkEvent()},children:"Splunk"})]}),Object(d.jsxs)("div",{children:[Object(d.jsx)("textarea",{id:"data",type:"textarea",rows:"8",cols:"100",title:"input data"}),Object(d.jsx)("textarea",{id:"result",type:"textarea",rows:"16",cols:"100",title:"output result"}),Object(d.jsx)("p",{id:"status",children:"\xa0"})]})]})]})]})}}]),n}(s.a.Component));n(16);var p=function(){return Object(d.jsxs)("div",{className:"App",children:[Object(d.jsx)(h,{mainId:"main"}),Object(d.jsx)(b,{title:"Person REST API",legend:"Operations:"})]})},j=function(t){t&&t instanceof Function&&n.e(3).then(n.bind(null,18)).then((function(e){var n=e.getCLS,o=e.getFID,s=e.getFCP,i=e.getLCP,c=e.getTTFB;n(t),o(t),s(t),i(t),c(t)}))};c.a.render(Object(d.jsx)(s.a.StrictMode,{children:Object(d.jsx)(p,{})}),document.getElementById("root")),j()}],[[17,1,2]]]);
  //# sourceMappingURL=main.ea7a4278.chunk.js.map