refactor: add attachment api
This commit is contained in:
parent
db1e57fca0
commit
6f54693eb1
2 changed files with 22 additions and 0 deletions
|
|
@ -490,6 +490,18 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
|||
return !(!res || res.status >= 400);
|
||||
}
|
||||
|
||||
async function attachment(opts: {
|
||||
action: 'get' | 'put' | 'delete';
|
||||
type: 'passport' | 'visa' | 'in-country-notice';
|
||||
id: string;
|
||||
}) {
|
||||
const res = await api[opts.action](
|
||||
`/employee/file-${opts.type}/${opts.id}`,
|
||||
);
|
||||
|
||||
if (res) return res.data;
|
||||
}
|
||||
|
||||
return {
|
||||
data,
|
||||
globalOption,
|
||||
|
|
@ -527,6 +539,8 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
|||
getAttachment,
|
||||
uploadAttachment,
|
||||
deleteAttachment,
|
||||
|
||||
attachment,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -88,3 +88,11 @@ export interface CreatedBy {
|
|||
code: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export type UploadFileObject = {
|
||||
_meta?: Record<string, any>;
|
||||
name?: string;
|
||||
group?: string;
|
||||
url?: string;
|
||||
file?: File;
|
||||
}[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue