var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _initializerDefineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/initializerDefineProperty"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _applyDecoratedDescriptor2=_interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));var _initializerWarningHelper2=_interopRequireDefault(require("@babel/runtime/helpers/initializerWarningHelper"));var _mobx=require("mobx");var _reactNative=require("react-native");var _api=require("../../services/api");var _class,_descriptor;var Store=(_class=function(){function Store(){(0,_classCallCheck2.default)(this,Store);(0,_initializerDefineProperty2.default)(this,"isLoading",_descriptor,this);}return(0,_createClass2.default)(Store,[{key:"getContract",value:function getContract(id,onSuccess){var response,_t;return _regenerator.default.async(function(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;this.isLoading=true;_context.next=1;return _regenerator.default.awrap(_api.Api.getInstance().getContract(id));case 1:response=_context.sent;console.log(response);this.isLoading=false;if(response.kind==='ok'){if(response.data.meta.errorCode===200){if(onSuccess)onSuccess(response.data.data);}else{_reactNative.Alert.alert('Thông báo',response.data.meta.errorMessage);}}else{_reactNative.Alert.alert('Thông báo','Có lỗi xảy ra. Vui lòng thử lại sau!');}_context.next=3;break;case 2:_context.prev=2;_t=_context["catch"](0);console.log(_t);case 3:case"end":return _context.stop();}},null,this,[[0,2]],Promise);}},{key:"getOtpSign",value:function getOtpSign(type){var response,_t2;return _regenerator.default.async(function(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=1;return _regenerator.default.awrap(_api.Api.getInstance().getOtpSign(type));case 1:response=_context2.sent;if(response.kind==='ok'){if(response.data.meta.errorCode===200){}else{_reactNative.Alert.alert('Thông báo',response.data.meta.errorMessage);}}else{_reactNative.Alert.alert('Thông báo','Có lỗi xảy ra. Vui lòng thử lại sau!');}_context2.next=3;break;case 2:_context2.prev=2;_t2=_context2["catch"](0);console.log(_t2);case 3:case"end":return _context2.stop();}},null,null,[[0,2]],Promise);}},{key:"confirmContract",value:function confirmContract(body,onSuccess){var response,_t3;return _regenerator.default.async(function(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;this.isLoading=true;_context3.next=1;return _regenerator.default.awrap(_api.Api.getInstance().confirmContract(body));case 1:response=_context3.sent;console.log(response);this.isLoading=false;if(response.kind==='ok'){if(response.data.meta.errorCode===200){if(onSuccess)onSuccess(response.data.data);}else{_reactNative.Alert.alert('Thông báo',response.data.meta.errorMessage);}}else{_reactNative.Alert.alert('Thông báo','Có lỗi xảy ra. Vui lòng thử lại sau!');}_context3.next=3;break;case 2:_context3.prev=2;_t3=_context3["catch"](0);console.log(_t3);case 3:case"end":return _context3.stop();}},null,this,[[0,2]],Promise);}}]);}(),_descriptor=(0,_applyDecoratedDescriptor2.default)(_class.prototype,"isLoading",[_mobx.observable],{configurable:true,enumerable:true,writable:true,initializer:function initializer(){return false;}}),(0,_applyDecoratedDescriptor2.default)(_class.prototype,"getContract",[_mobx.action],Object.getOwnPropertyDescriptor(_class.prototype,"getContract"),_class.prototype),(0,_applyDecoratedDescriptor2.default)(_class.prototype,"getOtpSign",[_mobx.action],Object.getOwnPropertyDescriptor(_class.prototype,"getOtpSign"),_class.prototype),(0,_applyDecoratedDescriptor2.default)(_class.prototype,"confirmContract",[_mobx.action],Object.getOwnPropertyDescriptor(_class.prototype,"confirmContract"),_class.prototype),_class);var SignTimaStore=new Store();var _default=exports.default=SignTimaStore;
//# sourceMappingURL=store.js.map