fix: แก้ function การสร้าง

This commit is contained in:
Net 2024-04-18 13:56:22 +07:00
parent 17b9450b47
commit 0458c33266
3 changed files with 17 additions and 15 deletions

View file

@ -64,18 +64,15 @@ const useBranchContactStore = defineStore('api-branch-contact', () => {
async function create(
branchId: string,
data: BranchContactCreate,
qrCodeImage?: File | null, // required but not strict
flow?: {
sessionId: string;
refTransactionId: string;
transactionId: string;
},
) {
const { ...payload } = data;
const res = await api.post<
BranchContact & { qrCodeImageUploadUrl: string }
>(`/branch/${branchId}/contact`, payload, {
>(`/branch/${branchId}/contact`, data, {
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
@ -83,14 +80,6 @@ const useBranchContactStore = defineStore('api-branch-contact', () => {
},
});
qrCodeImage &&
(await axios
.put(res.data.qrCodeImageUploadUrl, qrCodeImage, {
headers: { 'Content-Type': qrCodeImage.type },
onUploadProgress: (e) => console.log(e),
})
.catch((e) => console.error(e)));
if (!res) return false;
return res.data;