fixes
Build And Push Image / docker (push) Successful in 1m37s
Details
Build And Push Image / docker (push) Successful in 1m37s
Details
This commit is contained in:
parent
3da5a64dbb
commit
5d3518d256
|
|
@ -479,20 +479,32 @@ const onSelectImage = async (files: File[] | File | null) => {
|
|||
return;
|
||||
}
|
||||
|
||||
// Check if we have member data
|
||||
if (!memberData.value?.member_id) {
|
||||
snackbar.value = { show: true, message: 'Unable to upload: member ID not found.', color: 'error' };
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
uploading.value = true;
|
||||
const body = new FormData();
|
||||
body.append('file', file);
|
||||
body.append('image', file); // Changed from 'file' to 'image' to match backend expectation
|
||||
|
||||
await $fetch('/api/profile/upload-image', {
|
||||
method: 'POST',
|
||||
query: {
|
||||
memberId: memberData.value.member_id
|
||||
},
|
||||
body
|
||||
});
|
||||
|
||||
avatarBustKey.value++;
|
||||
selectedFiles.value = []; // Clear the file input
|
||||
snackbar.value = { show: true, message: 'Profile image updated.', color: 'success' };
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
snackbar.value = { show: true, message: 'Failed to upload image.', color: 'error' };
|
||||
} catch (e: any) {
|
||||
console.error('Upload error:', e);
|
||||
const errorMessage = e?.data?.message || e?.message || 'Failed to upload image.';
|
||||
snackbar.value = { show: true, message: errorMessage, color: 'error' };
|
||||
} finally {
|
||||
uploading.value = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue