refactor: header CustomerType
This commit is contained in:
parent
447330bfb5
commit
f3aca29cbb
1 changed files with 39 additions and 4 deletions
|
|
@ -360,14 +360,31 @@ const useCustomerStore = defineStore('api-customer', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createBranch(
|
async function createBranch(
|
||||||
data: CustomerBranchCreate & { customerId: string },
|
data: CustomerBranchCreate & { id?: string; customerId: string },
|
||||||
flow?: {
|
flow?: {
|
||||||
sessionId?: string;
|
sessionId?: string;
|
||||||
refTransactionId?: string;
|
refTransactionId?: string;
|
||||||
transactionId?: string;
|
transactionId?: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const { id, statusSave, code, file, ...payload } = data;
|
const {
|
||||||
|
customerCode,
|
||||||
|
registerCompanyName,
|
||||||
|
statusSave,
|
||||||
|
code,
|
||||||
|
file,
|
||||||
|
...payload
|
||||||
|
} = data;
|
||||||
|
|
||||||
|
if (payload.citizenId !== '') {
|
||||||
|
delete payload['registerDate'];
|
||||||
|
delete payload['registerName'];
|
||||||
|
delete payload['registerNameEN'];
|
||||||
|
delete payload['authorizedCapital'];
|
||||||
|
delete payload['legalPersonNo'];
|
||||||
|
} else {
|
||||||
|
delete payload['citizenId'];
|
||||||
|
}
|
||||||
|
|
||||||
const res = await api.post<CustomerBranch>('/customer-branch', payload, {
|
const res = await api.post<CustomerBranch>('/customer-branch', payload, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -385,14 +402,32 @@ const useCustomerStore = defineStore('api-customer', () => {
|
||||||
|
|
||||||
async function editBranchById(
|
async function editBranchById(
|
||||||
id: string,
|
id: string,
|
||||||
data: Partial<CustomerBranchCreate & { customerId: string }>,
|
data: Partial<CustomerBranchCreate & { id?: string; customerId: string }>,
|
||||||
flow?: {
|
flow?: {
|
||||||
sessionId?: string;
|
sessionId?: string;
|
||||||
refTransactionId?: string;
|
refTransactionId?: string;
|
||||||
transactionId?: string;
|
transactionId?: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const { code, branchNo, file, ...payload } = data;
|
const {
|
||||||
|
customerCode,
|
||||||
|
registerCompanyName,
|
||||||
|
statusSave,
|
||||||
|
code,
|
||||||
|
status,
|
||||||
|
file,
|
||||||
|
...payload
|
||||||
|
} = data;
|
||||||
|
|
||||||
|
if (payload.citizenId !== null) {
|
||||||
|
delete payload['registerDate'];
|
||||||
|
delete payload['registerName'];
|
||||||
|
delete payload['registerNameEN'];
|
||||||
|
delete payload['authorizedCapital'];
|
||||||
|
delete payload['legalPersonNo'];
|
||||||
|
} else {
|
||||||
|
delete payload['citizenId'];
|
||||||
|
}
|
||||||
|
|
||||||
const res = await api.put<CustomerBranch>(
|
const res = await api.put<CustomerBranch>(
|
||||||
`/customer-branch/${id}`,
|
`/customer-branch/${id}`,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue