fix:แก้ editById ให้ แก้ไขรูปได้
This commit is contained in:
parent
049a0406e1
commit
ceb39828ee
1 changed files with 22 additions and 7 deletions
|
|
@ -150,20 +150,35 @@ const useBranchStore = defineStore('api-branch', () => {
|
||||||
|
|
||||||
async function editById(
|
async function editById(
|
||||||
id: string,
|
id: string,
|
||||||
branch: Partial<BranchCreate & { status: 'ACTIVE' | 'INACTIVE' }>,
|
data: Partial<BranchCreate & { status: 'ACTIVE' | 'INACTIVE' }>,
|
||||||
|
qrCodeImage?: File,
|
||||||
flow?: {
|
flow?: {
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
refTransactionId: string;
|
refTransactionId: string;
|
||||||
transactionId: string;
|
transactionId: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const res = await api.put<Branch>(`/branch/${id}`, branch, {
|
const { ...payload } = data;
|
||||||
headers: {
|
const res = await api.put<Branch & { qrCodeImageUploadUrl: string }>(
|
||||||
'X-Session-Id': flow?.sessionId,
|
`/branch/${id}`,
|
||||||
'X-Rtid': flow?.refTransactionId,
|
payload,
|
||||||
'X-Tid': flow?.transactionId,
|
{
|
||||||
|
headers: {
|
||||||
|
'X-Session-Id': flow?.sessionId,
|
||||||
|
'X-Rtid': flow?.refTransactionId,
|
||||||
|
'X-Tid': flow?.transactionId,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
);
|
||||||
|
|
||||||
|
if (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;
|
if (!res) return false;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue