fixes
Build And Push Image / docker (push) Successful in 1m37s Details

This commit is contained in:
Matt 2025-08-14 15:44:18 +02:00
parent 3da5a64dbb
commit 5d3518d256
1 changed files with 16 additions and 4 deletions

View File

@ -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;
} }