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;
|
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 {
|
try {
|
||||||
uploading.value = true;
|
uploading.value = true;
|
||||||
const body = new FormData();
|
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', {
|
await $fetch('/api/profile/upload-image', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
query: {
|
||||||
|
memberId: memberData.value.member_id
|
||||||
|
},
|
||||||
body
|
body
|
||||||
});
|
});
|
||||||
|
|
||||||
avatarBustKey.value++;
|
avatarBustKey.value++;
|
||||||
selectedFiles.value = []; // Clear the file input
|
selectedFiles.value = []; // Clear the file input
|
||||||
snackbar.value = { show: true, message: 'Profile image updated.', color: 'success' };
|
snackbar.value = { show: true, message: 'Profile image updated.', color: 'success' };
|
||||||
} catch (e) {
|
} catch (e: any) {
|
||||||
console.error(e);
|
console.error('Upload error:', e);
|
||||||
snackbar.value = { show: true, message: 'Failed to upload image.', color: 'error' };
|
const errorMessage = e?.data?.message || e?.message || 'Failed to upload image.';
|
||||||
|
snackbar.value = { show: true, message: errorMessage, color: 'error' };
|
||||||
} finally {
|
} finally {
|
||||||
uploading.value = false;
|
uploading.value = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue