Enable file upload form

Enable error boundary to catch React errors (#7)
Fix warning for link noreferrer
Include authorization header with file upload
This commit is contained in:
John Wu
2021-01-20 13:36:40 -08:00
committed by GitHub
parent ec4dd7d35d
commit fcde299197
9 changed files with 43 additions and 24 deletions

View File

@@ -7,12 +7,13 @@ export const getCancelToken = () => {
return token.source();
}
export const uploadFile = (file, onProgress, cancelToken) => {
export const uploadFile = (file, token, onProgress, cancelToken) => {
const form = new FormData();
let options = {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data',
'Authorization': `Bearer ${token}`,
},
cancelToken,
};