-
Notifications
You must be signed in to change notification settings - Fork 0
/
component---src-pages-manage-js-a3e809078cd500aea443.js
1 lines (1 loc) · 3.22 KB
/
component---src-pages-manage-js-a3e809078cd500aea443.js
1
"use strict";(self.webpackChunkgatsby_redux_material_ui_boilerplate=self.webpackChunkgatsby_redux_material_ui_boilerplate||[]).push([[981],{50895:function(e,t,r){r.r(t);var n=r(59713),u=r.n(n),a=r(48926),c=r.n(a),s=r(63038),o=r.n(s),i=r(87757),p=r.n(i),l=r(67294),f=(r(36176),r(17951)),b=(r(90174),r(24251)),d=(r(38538),r(92492),r(8359),r(22840)),y=r(68152),m=r(66449),h=(r(27591),r(48767),r(36916),r(44325),r(89493),r(69360)),j=r(20332),v=(r(59263),r(57154),r(26651)),x=(r(35313),r(85893));function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){u()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var S=l.useEffect;(0,y.Z)({});t.default=function(){var e=(0,v.Z)(),t=e.isAuth,r=e.env,n=(0,l.useState)([]),u=o()(n,2),a=u[0],s=u[1],i=(0,l.useState)(""),y=o()(i,2),O=(y[0],y[1],(0,l.useState)("")),_=o()(O,2),g=(_[0],_[1],(0,l.useState)("")),k=o()(g,2),Z=(k[0],k[1],(0,l.useState)("")),P=o()(Z,2),I=(P[0],P[1],(0,l.useState)("")),C=o()(I,2),D=(C[0],C[1],(0,l.useState)(null)),q=o()(D,2),E=(q[0],q[1],(0,l.useState)([])),A=o()(E,2),F=(A[0],A[1],(0,m.Z)()),H=(0,l.useState)(),J=o()(H,2),N=(J[0],J[1],(0,d.Z)(F.breakpoints.up("sm")),(0,l.useState)()),T=o()(N,2),z=(T[0],T[1],(0,l.useState)("")),B=o()(z,2),G=B[0],K=(B[1],function(){var e=c()(p().mark((function e(){var t,n,u=arguments;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>0&&void 0!==u[0]?u[0]:"",e.next=3,h.Z.Cloud.run("queryItems",{type:"post_public-".concat(r),query:{equalTo:["name",t]}});case 3:n=e.sent,s((null==n?void 0:n.map((function(e){return e.toJSON()})))||[]);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}());S(c()(p().mark((function e(){return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:K(G);case 1:case"end":return e.stop()}}),e)}))),[G]);var L=function(){var e=c()(p().mark((function e(t){return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h.Z.Cloud.run("deleteItems",{ids:[t._objectId]});case 2:K(G);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),M=function(){var e=c()(p().mark((function e(t){return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t._objectId){e.next=5;break}return e.next=3,h.Z.Cloud.run("updateItem",{type:"post_public-".concat(r),objectId:t._objectId,data:w({},t),name:G});case 3:e.next=7;break;case 5:return e.next=7,h.Z.Cloud.run("createItem",{type:"post_public-".concat(r),data:w({},t),name:G});case 7:K(G);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(b.Z,{title:"Home"}),(0,x.jsx)(f.Z,{display:"flex",justifyContent:"center",flexDirection:"column",gap:"16px",children:(0,x.jsx)(j.Z,{list:a,isAuth:t(),handleDelete:L,onPost:M})})]})}}}]);