Commit c4352960 authored by Garfield Dai's avatar Garfield Dai

Merge branch 'chore/upload-quota' into deploy/dev

parents dada397a 5992c9cc
......@@ -134,7 +134,7 @@ const FileUploader = ({
xhr: new XMLHttpRequest(),
data: formData,
onprogress: onProgress,
})
}, false, undefined, '?source=datasets')
.then((res: File) => {
const completeFile = {
fileID: fileItem.fileID,
......@@ -146,8 +146,8 @@ const FileUploader = ({
onFileUpdate(completeFile, 100, fileListCopy)
return Promise.resolve({ ...completeFile })
})
.catch(() => {
notify({ type: 'error', message: t('datasetCreation.stepOne.uploader.failed') })
.catch((e) => {
notify({ type: 'error', message: e?.response?.code === 'forbidden' ? e?.response?.message : t('datasetCreation.stepOne.uploader.failed') })
onFileUpdate(fileItem, -2, fileListCopy)
return Promise.resolve({ ...fileItem })
})
......
......@@ -308,7 +308,7 @@ const baseFetch = <T>(
]) as Promise<T>
}
export const upload = (options: any, isPublicAPI?: boolean, url?: string): Promise<any> => {
export const upload = (options: any, isPublicAPI?: boolean, url?: string, searchParams?: string): Promise<any> => {
const urlPrefix = isPublicAPI ? PUBLIC_API_PREFIX : API_PREFIX
let token = ''
if (isPublicAPI) {
......@@ -329,7 +329,7 @@ export const upload = (options: any, isPublicAPI?: boolean, url?: string): Promi
}
const defaultOptions = {
method: 'POST',
url: url ? `${urlPrefix}${url}` : `${urlPrefix}/files/upload`,
url: (url ? `${urlPrefix}${url}` : `${urlPrefix}/files/upload`) + (searchParams || ''),
headers: {
Authorization: `Bearer ${token}`,
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment