Add image upload to s3
This commit is contained in:
@@ -40,7 +40,24 @@ const uploading = ref(false);
|
||||
async function submit() {
|
||||
uploading.value = true;
|
||||
|
||||
// TODO: add upload logic
|
||||
const body = new FormData();
|
||||
|
||||
if (data.value?.answer?.updatedAt) {
|
||||
body.set('updatedAt', data.value?.answer?.updatedAt);
|
||||
}
|
||||
if (answer.value) {
|
||||
body.set('answer', answer.value);
|
||||
}
|
||||
if (newImage.value) {
|
||||
body.set('image', newImage.value);
|
||||
}
|
||||
|
||||
const result = await $fetch(`/api/quest/${questSlug?.id}/submit`, {
|
||||
method: 'POST',
|
||||
body
|
||||
});
|
||||
|
||||
console.log(result);
|
||||
await refresh();
|
||||
|
||||
uploading.value = false;
|
||||
|
||||
Reference in New Issue
Block a user