forked from ibi-group/datatools-ui
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(file-upload): Place file uploads directly in request body
This change removes the use of multipart form data uploads in favor of placing the file directly in the request body. This change is in response to catalogueglobal/datatools-server#57.
- Loading branch information
1 parent
71b46e6
commit 92194c3
Showing
3 changed files
with
48 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import fetch from 'isomorphic-fetch' | ||
|
||
export function uploadFile ({file, url, token}) { | ||
return fetch(url, { | ||
method: 'post', | ||
headers: { | ||
'Authorization': 'Bearer ' + token, | ||
// 'Content-Type': 'application/zip' | ||
}, | ||
body: file | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters