fix: video upload api body and error control (#782)
This commit is contained in:
@@ -174,18 +174,21 @@ export async function uploadVideo(
|
||||
uploadFile,
|
||||
edxVideoId,
|
||||
) {
|
||||
const formData = new FormData();
|
||||
formData.append('uploaded-file', uploadFile);
|
||||
const uploadErrors = [];
|
||||
|
||||
await fetch(uploadUrl, {
|
||||
method: 'PUT',
|
||||
body: formData,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'Content-Disposition': `attachment; filename="${uploadFile.name}"`,
|
||||
'Content-Type': uploadFile.type,
|
||||
},
|
||||
multipart: false,
|
||||
body: uploadFile,
|
||||
})
|
||||
.then(async () => {
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error();
|
||||
}
|
||||
await getAuthenticatedHttpClient()
|
||||
.post(getCourseVideosApiUrl(courseId), [{
|
||||
edxVideoId,
|
||||
|
||||
Reference in New Issue
Block a user