{"ast":null,"code":"import _regeneratorRuntime from\"C:/laragon/www/iot.mksolusi/DriverOPCDA/frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/regenerator\";import _asyncToGenerator from\"C:/laragon/www/iot.mksolusi/DriverOPCDA/frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator\";import _classCallCheck from\"C:/laragon/www/iot.mksolusi/DriverOPCDA/frontend/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/classCallCheck\";import axios from\"axios\";var RoleServicesClass=function RoleServicesClass(){_classCallCheck(this,RoleServicesClass);this.getRoles=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(){return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:return _context2.abrupt(\"return\",new Promise(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve,reject){return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return axios.get(process.env.REACT_APP_BASE_URL+\"/roles\").then(function(res){resolve(res.data);});case 2:case\"end\":return _context.stop();}}},_callee);}));return function(_x,_x2){return _ref2.apply(this,arguments);};}()));case 1:case\"end\":return _context2.stop();}}},_callee2);}));this.storeRole=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(params){return _regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:return _context4.abrupt(\"return\",new Promise(/*#__PURE__*/function(){var _ref4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(resolve,reject){return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.next=2;return axios.post(process.env.REACT_APP_BASE_URL+\"/roles\",params).then(function(res){resolve(res.data);});case 2:case\"end\":return _context3.stop();}}},_callee3);}));return function(_x4,_x5){return _ref4.apply(this,arguments);};}()));case 1:case\"end\":return _context4.stop();}}},_callee4);}));return function(_x3){return _ref3.apply(this,arguments);};}();this.findRole=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id){return _regeneratorRuntime.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:return _context6.abrupt(\"return\",new Promise(/*#__PURE__*/function(){var _ref6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(resolve,reject){return _regeneratorRuntime.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:_context5.next=2;return axios.put(process.env.REACT_APP_BASE_URL+\"/roles/\"+id).then(function(res){resolve(res.data);});case 2:case\"end\":return _context5.stop();}}},_callee5);}));return function(_x7,_x8){return _ref6.apply(this,arguments);};}()));case 1:case\"end\":return _context6.stop();}}},_callee6);}));return function(_x6){return _ref5.apply(this,arguments);};}();this.updateRole=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(id,params){return _regeneratorRuntime.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:return _context8.abrupt(\"return\",new Promise(/*#__PURE__*/function(){var _ref8=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(resolve,reject){return _regeneratorRuntime.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:_context7.next=2;return axios.patch(process.env.REACT_APP_BASE_URL+\"/roles/\"+id,params).then(function(res){resolve(res.data);});case 2:case\"end\":return _context7.stop();}}},_callee7);}));return function(_x11,_x12){return _ref8.apply(this,arguments);};}()));case 1:case\"end\":return _context8.stop();}}},_callee8);}));return function(_x9,_x10){return _ref7.apply(this,arguments);};}();this.deleterole=/*#__PURE__*/function(){var _ref9=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id){return _regeneratorRuntime.wrap(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:return _context10.abrupt(\"return\",new Promise(/*#__PURE__*/function(){var _ref10=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(resolve,reject){return _regeneratorRuntime.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:_context9.next=2;return axios.delete(process.env.REACT_APP_BASE_URL+\"/roles/\"+id).then(function(res){resolve(res.data);});case 2:case\"end\":return _context9.stop();}}},_callee9);}));return function(_x14,_x15){return _ref10.apply(this,arguments);};}()));case 1:case\"end\":return _context10.stop();}}},_callee10);}));return function(_x13){return _ref9.apply(this,arguments);};}();};export default RoleServicesClass;","map":{"version":3,"sources":["C:/laragon/www/iot.mksolusi/DriverOPCDA/frontend/src/components/pages/Roles/RoleServicesClass.ts"],"names":["axios","RoleServicesClass","getRoles","Promise","resolve","reject","get","process","env","REACT_APP_BASE_URL","then","res","data","storeRole","params","post","findRole","id","put","updateRole","patch","deleterole","delete"],"mappings":"ofAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,C,GAEMC,CAAAA,iB,2EACGC,Q,sEAAW,yKACT,GAAIC,CAAAA,OAAJ,2FAAY,iBAAOC,OAAP,CAAgBC,MAAhB,wIACXL,CAAAA,KAAK,CAACM,GAAN,CAAUC,OAAO,CAACC,GAAR,CAAYC,kBAAZ,CAAiC,QAA3C,EAAqDC,IAArD,CAA0D,SAACC,GAAD,CAAS,CACvEP,OAAO,CAACO,GAAG,CAACC,IAAL,CAAP,CACD,CAFK,CADW,uDAAZ,oEADS,0D,QAQXC,S,2FAAY,kBAAOC,MAAP,uJACV,GAAIX,CAAAA,OAAJ,2FAAY,kBAAOC,OAAP,CAAgBC,MAAhB,6IACXL,CAAAA,KAAK,CACRe,IADG,CACER,OAAO,CAACC,GAAR,CAAYC,kBAAZ,CAAiC,QADnC,CAC6CK,MAD7C,EAEHJ,IAFG,CAEE,SAACC,GAAD,CAAS,CACbP,OAAO,CAACO,GAAG,CAACC,IAAL,CAAP,CACD,CAJG,CADW,yDAAZ,qEADU,0D,sEAUZI,Q,2FAAW,kBAAOC,EAAP,uJACT,GAAId,CAAAA,OAAJ,2FAAY,kBAAOC,OAAP,CAAgBC,MAAhB,6IACXL,CAAAA,KAAK,CACRkB,GADG,CACCX,OAAO,CAACC,GAAR,CAAYC,kBAAZ,CAAiC,SAAjC,CAA6CQ,EAD9C,EAEHP,IAFG,CAEE,SAACC,GAAD,CAAS,CACbP,OAAO,CAACO,GAAG,CAACC,IAAL,CAAP,CACD,CAJG,CADW,yDAAZ,qEADS,0D,sEAUXO,U,2FAAa,kBAAOF,EAAP,CAAmBH,MAAnB,uJACX,GAAIX,CAAAA,OAAJ,2FAAY,kBAAOC,OAAP,CAAgBC,MAAhB,6IACXL,CAAAA,KAAK,CACRoB,KADG,CACGb,OAAO,CAACC,GAAR,CAAYC,kBAAZ,CAAiC,SAAjC,CAA6CQ,EADhD,CACoDH,MADpD,EAEHJ,IAFG,CAEE,SAACC,GAAD,CAAS,CACbP,OAAO,CAACO,GAAG,CAACC,IAAL,CAAP,CACD,CAJG,CADW,yDAAZ,uEADW,0D,2EAUbS,U,2FAAa,mBAAOJ,EAAP,4JACX,GAAId,CAAAA,OAAJ,4FAAY,kBAAOC,OAAP,CAAgBC,MAAhB,6IACXL,CAAAA,KAAK,CACRsB,MADG,CACIf,OAAO,CAACC,GAAR,CAAYC,kBAAZ,CAAiC,SAAjC,CAA6CQ,EADjD,EAEHP,IAFG,CAEE,SAACC,GAAD,CAAS,CACbP,OAAO,CAACO,GAAG,CAACC,IAAL,CAAP,CACD,CAJG,CADW,yDAAZ,wEADW,4D,oEAWtB,cAAeX,CAAAA,iBAAf","sourcesContent":["import axios from \"axios\";\r\n\r\nclass RoleServicesClass {\r\n  public getRoles = async () => {\r\n    return new Promise(async (resolve, reject) => {\r\n      await axios.get(process.env.REACT_APP_BASE_URL + \"/roles\").then((res) => {\r\n        resolve(res.data);\r\n      });\r\n    });\r\n  };\r\n\r\n  public storeRole = async (params: any) => {\r\n    return new Promise(async (resolve, reject) => {\r\n      await axios\r\n        .post(process.env.REACT_APP_BASE_URL + \"/roles\", params)\r\n        .then((res) => {\r\n          resolve(res.data);\r\n        });\r\n    });\r\n  };\r\n\r\n  public findRole = async (id: number) => {\r\n    return new Promise(async (resolve, reject) => {\r\n      await axios\r\n        .put(process.env.REACT_APP_BASE_URL + \"/roles/\" + id)\r\n        .then((res) => {\r\n          resolve(res.data);\r\n        });\r\n    });\r\n  };\r\n\r\n  public updateRole = async (id: number, params: any) => {\r\n    return new Promise(async (resolve, reject) => {\r\n      await axios\r\n        .patch(process.env.REACT_APP_BASE_URL + \"/roles/\" + id, params)\r\n        .then((res) => {\r\n          resolve(res.data);\r\n        });\r\n    });\r\n  };\r\n\r\n  public deleterole = async (id: number) => {\r\n    return new Promise(async (resolve, reject) => {\r\n      await axios\r\n        .delete(process.env.REACT_APP_BASE_URL + \"/roles/\" + id)\r\n        .then((res) => {\r\n          resolve(res.data);\r\n        });\r\n    });\r\n  };\r\n}\r\n\r\nexport default RoleServicesClass;\r\n"]},"metadata":{},"sourceType":"module"}