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;
|
group: T;
|
||||||
parentId: string;
|
parentId: string;
|
||||||
meta: any;
|
meta: any;
|
||||||
file: File;
|
file?: File;
|
||||||
}) => {
|
}) => {
|
||||||
const url = `${base}/${opts.parentId}/${opts.group}`;
|
const url = `${base}/${opts.parentId}/${opts.group}`;
|
||||||
const res = await api.post<typeof opts.meta>(url, opts.meta);
|
const res = await api.post<typeof opts.meta>(url, opts.meta);
|
||||||
|
|
||||||
if (res.status < 400) {
|
if (res.status < 400) {
|
||||||
await manageFile(api, base).putFile({
|
if (opts.file !== undefined) {
|
||||||
parentId: opts.parentId,
|
await manageFile(api, base).putFile({
|
||||||
group: opts.group,
|
parentId: opts.parentId,
|
||||||
fileId: res.data.id,
|
group: opts.group,
|
||||||
file: opts.file,
|
fileId: res.data.id,
|
||||||
});
|
file: opts.file,
|
||||||
|
});
|
||||||
|
}
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue