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

@ -4,6 +4,7 @@ import { Pagination } from '../types';
import { api } from 'src/boot/axios';
import { Branch, BranchCreate } from './types';
import { BranchContact } from '../branch-contact/types';
import axios from 'axios';
type BranchId = string;
@ -123,9 +124,11 @@ const useBranchStore = defineStore('api-branch', () => {
transactionId: string;
},
) {
const { qrCodeImage, ...payload } = branch;
const res = await api.post<
Branch & { qrCodeImageUrl: string; qrCodeImageUploadUrl: string }
>('/branch', branch, {
>('/branch', payload, {
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
@ -133,6 +136,13 @@ const useBranchStore = defineStore('api-branch', () => {
},
});
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;