{"version":3,"file":"js/app/models/app/profile/reducers.ts.ffed8267.js","mappings":"qvBAQA,IAAMA,EAAwB,CAC5BC,gBAAiB,GACjBC,gBAAiB,GACjBC,aAAc,GACdC,0BAA2B,GAC3BC,gCAAiC,GACjCC,uBAAwB,GACxBC,yBAA0B,GAC1BC,aAAc,GACdC,oBAAqB,GACrBC,aAAc,GACdC,eAAgB,GAChBC,aAAc,GACdC,aAAc,GACdC,cAAe,GACfC,YAAa,GACbC,MAAO,GACPC,kBAAmB,GACnBC,WAAY,GACZC,KAAM,IAGFC,EAA+B,CACnCC,KAAM,CACJC,cAAetB,EACfuB,UAAW,KAITC,EAAiB,WAA8E,IAA7EC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAsBN,EAAgBS,EAAqBH,UAAAC,OAAA,EAAAD,UAAA,QAAAE,EACjF,OAAQC,EAAOC,OACRC,EAAAA,EAAAA,gBACHC,EAAAA,EAAA,GAAYP,GAAK,IAAEJ,KAAMQ,EAAOI,OAGhCD,EAAA,GAAYP,EAElB,EAEMS,EAAiB,CACrBC,gBAAiBA,CAACC,EAAiBC,IACzBC,IACCC,EAAAA,EAAAA,IAASF,GAAOG,IAAI,+CAADC,OAAgDL,IACvEM,MAAMC,IACLL,EAAS,CACPL,KAAMU,EAASV,KACfH,KAAMC,EAAAA,EAAAA,iBACN,IAIVa,gBAAiBA,CAACR,EAA4BC,KACrCE,EAAAA,EAAAA,IAASF,GAAOQ,IACrB,mDACAT,GACAM,MAAMC,IACN,GAAwB,MAApBA,EAASG,OAGX,OAFAC,EAAAA,EAAAA,QAAe,sCAER,I","sources":["webpack://NX/./src/models/app/profile/reducers.ts"],"sourcesContent":["import { apiFetch } from '@api/base';\nimport { notify } from '@lib/notify';\nimport type { TAction, TDispatch } from '@models/types';\n\nimport { ProfileActionType } from './types';\n\nimport type { CustomerDataModel, ProfileAction, ProfileModel } from './types';\n\nconst DEFAULT_CUSTOMER_DATA = {\n company_account: '',\n company_address: '',\n company_area: '',\n company_authority_contact: '',\n company_authority_correspondent: '',\n company_authority_name: '',\n company_authority_status: '',\n company_bank: '',\n company_certificate: '',\n company_city: '',\n company_holder: '',\n company_name: '',\n company_NPWP: '',\n company_phone: '',\n company_zip: '',\n email: '',\n group_description: '',\n group_name: '',\n name: ''\n};\n\nconst ProfileDefault: ProfileModel = {\n main: {\n groupMetaData: DEFAULT_CUSTOMER_DATA,\n groupName: ''\n }\n};\n\nconst ProfileReducer = (state: ProfileModel = ProfileDefault, action: ProfileAction): ProfileModel => {\n switch (action.type) {\n case ProfileActionType.GetCustomerData:\n return { ...state, main: action.data };\n\n default:\n return { ...state };\n }\n};\n\nconst ProfileCommand = {\n getCustomerData: (payload: string, token: string): TAction => {\n return (dispatch: TDispatch) => {\n return apiFetch(token).get(`/registration/1.0/agent/get-user-data?token=${payload}`)\n .then((response) => {\n dispatch({\n data: response.data,\n type: ProfileActionType.GetCustomerData\n });\n });\n };\n },\n putCustomerData: (payload: CustomerDataModel, token: string): Promise => {\n return apiFetch(token).put(\n '/registration/1.0/agent/update-registration-data',\n payload\n ).then((response) => {\n if (response.status === 200) {\n notify.success('Berhasil memperbaharui profil anda');\n\n return 'ok';\n }\n });\n }\n};\n\nexport { ProfileCommand, ProfileReducer, ProfileDefault, DEFAULT_CUSTOMER_DATA };\n"],"names":["DEFAULT_CUSTOMER_DATA","company_account","company_address","company_area","company_authority_contact","company_authority_correspondent","company_authority_name","company_authority_status","company_bank","company_certificate","company_city","company_holder","company_name","company_NPWP","company_phone","company_zip","email","group_description","group_name","name","ProfileDefault","main","groupMetaData","groupName","ProfileReducer","state","arguments","length","undefined","action","type","ProfileActionType","_objectSpread","data","ProfileCommand","getCustomerData","payload","token","dispatch","apiFetch","get","concat","then","response","putCustomerData","put","status","notify"],"sourceRoot":""}