Upload video bug fix

This commit is contained in:
Rotimi Best
2023-08-11 09:26:40 +01:00
parent 5e252e21e7
commit 3754ef90bd
2 changed files with 48 additions and 44 deletions
@@ -102,7 +102,7 @@
</span> </span>
<PrimaryButton label="Try again" /> <PrimaryButton label="Try again" />
</div> </div>
{:else if $uploadCourseVideoStore.formRes?.success} {:else if !$uploadCourseVideoStore.formRes?.success}
<div class="h-full w-full flex flex-col items-center justify-center rounded-xl"> <div class="h-full w-full flex flex-col items-center justify-center rounded-xl">
<img src="/video-upload-error.svg" alt="upload error" /> <img src="/video-upload-error.svg" alt="upload error" />
<span class="pt-3 pb-2"> <span class="pt-3 pb-2">
@@ -30,6 +30,7 @@ const S3 = new S3Client({
const supabase = getSupabase(); const supabase = getSupabase();
const uploadToMuse = (s3Data, fileName, lessonId, fileUrl) => { const uploadToMuse = (s3Data, fileName, lessonId, fileUrl) => {
try {
const form = new FormData(); const form = new FormData();
form.append('file', s3Data, fileName); form.append('file', s3Data, fileName);
@@ -76,6 +77,9 @@ const uploadToMuse = (s3Data, fileName, lessonId, fileUrl) => {
.catch(function (error) { .catch(function (error) {
console.log('Upload to Muse failed', error); console.log('Upload to Muse failed', error);
}); });
} catch (error) {
console.log('Upload to Muse failed', error);
}
}; };
export const load = ({ params = { id: '' } }) => { export const load = ({ params = { id: '' } }) => {