update: add local-proxy library
This commit is contained in:
@@ -192,19 +192,17 @@ const uploadFiles = async (files: string[], directory: string, opts: UploadFileO
|
||||
}
|
||||
const token = await storage.getItem('token');
|
||||
const checkUrl = new URL('/api/s1/resources/upload/check', getBaseURL());
|
||||
const res = await query
|
||||
.adapter({ url: checkUrl.toString(), method: 'POST', body: data, headers: { Authorization: 'Bearer ' + token, contentType: 'application/json' } })
|
||||
.then((res) => {
|
||||
try {
|
||||
if (typeof res === 'string') {
|
||||
return JSON.parse(res);
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
} catch (error) {
|
||||
return typeof res === 'string' ? {} : res;
|
||||
const res = await query.adapter({ url: checkUrl.toString(), method: 'POST', body: data, headers: { Authorization: 'Bearer ' + token } }).then((res) => {
|
||||
try {
|
||||
if (typeof res === 'string') {
|
||||
return JSON.parse(res);
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
return typeof res === 'string' ? {} : res;
|
||||
}
|
||||
});
|
||||
const checkData: { path: string; isUpload: boolean }[] = res.data;
|
||||
if (res.code !== 200) {
|
||||
console.error('check failed', res);
|
||||
|
||||
Reference in New Issue
Block a user