refactor: put File return data at

succeed
This commit is contained in:
Net 2024-08-28 09:48:36 +07:00 committed by Methapon Metanipat
parent d66c2b3469
commit 7bcdb26c4b

View file

@ -215,7 +215,7 @@ const useCustomerStore = defineStore('api-customer', () => {
file: File; file: File;
filename?: string; filename?: string;
}) { }) {
await api.put( const res = await api.put(
`/customer-branch/${opts.branchId}/attachment/${opts.filename || opts.file.name}`, `/customer-branch/${opts.branchId}/attachment/${opts.filename || opts.file.name}`,
opts.file, opts.file,
{ {
@ -223,6 +223,10 @@ const useCustomerStore = defineStore('api-customer', () => {
onUploadProgress: (e) => console.log(e), onUploadProgress: (e) => console.log(e),
}, },
); );
if (res.status >= 400) return false;
return true;
} }
async function deleteAttachment(id: string, filename: string) { async function deleteAttachment(id: string, filename: string) {