2 lines
8.5 KiB
JavaScript
2 lines
8.5 KiB
JavaScript
|
(this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{161:function(t,e,n){},163:function(t,e,n){},261:function(t,e,n){"use strict";n.r(e);var r=n(0),a=n(24),c=n.n(a),s=(n(161),n(162),n(163),n(81)),u=n(25),i=n(15),o=n.n(i),l=n(27),p=n(41),j=n(152),b=n(266),f=n(263),h=n(40),d=n(90),O=n(55),x=n.n(O),m="prod";if("jank"===m){x.a.defaults.baseURL="http://192.168.1.107:5000"}var v=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.post("/api/clients",e);case 2:return n=t.sent,t.abrupt("return",n.data.client_id);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),g=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.get("/api/clients/".concat(e));case 2:return n=t.sent,t.abrupt("return",n.data);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),w=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.post("/api/clients/".concat(e,"/session"));case 2:return n=t.sent,t.abrupt("return",n.data);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),k=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.get("/api/clients/".concat(e,"/session"));case 2:return n=t.sent,t.abrupt("return",n.data);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),y=function(){var t=Object(l.a)(o.a.mark((function t(e){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.delete("/api/clients/".concat(e,"/session"));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),C=function(){var t=Object(l.a)(o.a.mark((function t(e){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,y(e);case 2:return t.next=4,w(e);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),S=n(8),I=function(){var t=Object(u.f)(),e=Object(r.useState)(null),n=Object(p.a)(e,2),a=n[0],c=n[1],s=Object(r.useState)(""),i=Object(p.a)(s,2),O=i[0],x=i[1],m=Object(r.useState)(""),g=Object(p.a)(m,2),w=g[0],k=g[1],y=Object(r.useState)(""),C=Object(p.a)(y,2),I=C[0],F=C[1],P=function(){var e=Object(l.a)(o.a.mark((function e(n){var r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.preventDefault(),!(I.length<10)){e.next=5;break}return j.b.error("Check all fields!"),c("Phone number needs to be a length of at least 10"),e.abrupt("return");case 5:return e.next=7,v({name:O,email:w,phone:parseInt(I)});case 7:r=e.sent,t.push("/sessions/".concat(r));case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(S.jsxs)(d.Content,{children:[Object(S.jsx)(b.a,{title:"Dashboard",subTitle:"Enter the name, email and phone number of the subject"}),Object(S.jsx)(f.a,{}),Object(S.jsxs)("form",{onSubmit:P,children:[Object(S.jsxs)("label",{htmlFor:"name",children:["Name:",Object(S.jsx)("input",{minLength:3,value:O,onChange:function(t){return x(t.target.value)},name:"name"})]}),Object(S.jsxs)("label",{htmlFor:"email",children:["Email:",Object(S.jsx)("input",{value:w,onChange:function(t){return k(t.target.value)},type:"email",name:"email"})]}),Object(S.jsxs)("label",{htmlFor:"phone",children:["Phone:",Object(S.jsx)("input",{value:I,onChange:function(t){return F(t.target.value)},type:"tel",name:"phone"})]}),Object(S.jsx)(h.a,{danger:!0,onClick:function(){x(""),k(""),F("")},children:"Reset"}),Object(S.jsx)(h.a,{htmlType:"submit",type:"primary",children:"Start Session"}),a&&Object(S.jsx)("p",{className:"error",children:a})]})]})},F=n(268),P=n(267),T=n(264),D=function(t){var e=t.clientId,n=Object(r.useState)(null),a=Object(p.a)(n,2),c=a[0],s=a[1],u=Object(r.useState)(
|
||
|
//# sourceMappingURL=main.333f1baa.chunk.js.map
|