refactor: file can is null
This commit is contained in:
parent
2dd25ad157
commit
6879d0868c
1 changed files with 9 additions and 8 deletions
|
|
@ -353,19 +353,20 @@ export function manageMeta<T extends string>(api: AxiosInstance, base: string) {
|
|||
group: T;
|
||||
parentId: string;
|
||||
meta: any;
|
||||
file: File;
|
||||
file?: File;
|
||||
}) => {
|
||||
const url = `${base}/${opts.parentId}/${opts.group}`;
|
||||
const res = await api.post<typeof opts.meta>(url, opts.meta);
|
||||
|
||||
if (res.status < 400) {
|
||||
await manageFile(api, base).putFile({
|
||||
parentId: opts.parentId,
|
||||
group: opts.group,
|
||||
fileId: res.data.id,
|
||||
file: opts.file,
|
||||
});
|
||||
|
||||
if (opts.file !== undefined) {
|
||||
await manageFile(api, base).putFile({
|
||||
parentId: opts.parentId,
|
||||
group: opts.group,
|
||||
fileId: res.data.id,
|
||||
file: opts.file,
|
||||
});
|
||||
}
|
||||
return res.data;
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue