fix: customer branch function

This commit is contained in:
puriphatt 2024-09-18 11:41:34 +07:00
parent 2dc6902ff5
commit 7ecd6d4002

View file

@ -251,6 +251,8 @@ const useCustomerStore = defineStore('api-customer', () => {
} }
if (!data.customerBranch[0].birthDate) if (!data.customerBranch[0].birthDate)
delete data.customerBranch[0]['birthDate']; delete data.customerBranch[0]['birthDate'];
if (!data.customerBranch[0].registerDate)
delete data.customerBranch[0]['registerDate'];
} }
const { customerBranch, image, ...payload } = data; const { customerBranch, image, ...payload } = data;
@ -359,16 +361,6 @@ const useCustomerStore = defineStore('api-customer', () => {
codeCustomer: string; codeCustomer: string;
}, },
) { ) {
const {
codeCustomer,
statusSave,
code,
file,
birthDate,
citizen,
...payload
} = data;
if (data.citizenId) { if (data.citizenId) {
delete data['authorizedNameEN']; delete data['authorizedNameEN'];
delete data['authorizedName']; delete data['authorizedName'];
@ -380,11 +372,18 @@ const useCustomerStore = defineStore('api-customer', () => {
} else { } else {
delete data['citizenId']; delete data['citizenId'];
} }
console.log(data.birthDate); if (!data.birthDate) delete data['birthDate'];
console.log(!data.birthDate); if (!data.registerDate) delete data['registerDate'];
if (!data.birthDate) {
delete data['birthDate']; const {
} codeCustomer,
statusSave,
code,
file,
birthDate,
citizen,
...payload
} = data;
const res = await api.post<CustomerBranch>('/customer-branch', payload); const res = await api.post<CustomerBranch>('/customer-branch', payload);
if (!res) return false; if (!res) return false;
@ -431,6 +430,7 @@ const useCustomerStore = defineStore('api-customer', () => {
delete data['citizenId']; delete data['citizenId'];
} }
if (!data.birthDate) delete data['birthDate']; if (!data.birthDate) delete data['birthDate'];
if (!data.registerDate) delete data['registerDate'];
const { const {
code, code,