Improve UploadFile() API.

This commit is contained in:
Yang Luo
2021-08-14 15:58:12 +08:00
parent b7e0a4fe4e
commit 004282f970
5 changed files with 48 additions and 51 deletions

View File

@ -76,10 +76,10 @@ export function getAffiliationOptions(url, code) {
}).then(res => res.json());
}
export function uploadFile(folder, subFolder, file) {
export function uploadFile(owner, tag, parent, fullFilePath, file) {
let formData = new FormData();
formData.append("file", file);
return fetch(`${Setting.ServerUrl}/api/upload-file?folder=${encodeURIComponent(folder)}&subFolder=${encodeURIComponent(subFolder)}`, {
return fetch(`${Setting.ServerUrl}/api/upload-file?owner=${owner}&tag=${tag}&parent=${parent}&fullFilePath=${encodeURIComponent(fullFilePath)}`, {
body: formData,
method: 'POST',
credentials: 'include',