feat: Redirect authenticated users from auth pages and enable event-driven profile data refresh in the settings sidebar.
This commit is contained in:
@@ -189,20 +189,13 @@ export function ProfileSettingsForm({
|
||||
// Clean up local preview URL only after successful presigned URL
|
||||
URL.revokeObjectURL(localPreviewUrl);
|
||||
|
||||
// Update the session to reflect the new avatar
|
||||
await updateSession({
|
||||
...session,
|
||||
user: {
|
||||
...session?.user,
|
||||
image: presignedUrl,
|
||||
},
|
||||
});
|
||||
|
||||
// Dispatch event to notify header to refresh profile data
|
||||
window.dispatchEvent(new Event('profile-updated'));
|
||||
} catch {
|
||||
// If presigned URL fails, keep the local preview (don't revoke it)
|
||||
console.warn('Could not get presigned URL, using local preview');
|
||||
// Still dispatch event to refresh header
|
||||
window.dispatchEvent(new Event('profile-updated'));
|
||||
}
|
||||
|
||||
setSuccessMessage('Profile picture updated successfully!');
|
||||
@@ -254,15 +247,6 @@ export function ProfileSettingsForm({
|
||||
}
|
||||
setAvatarUrl(null);
|
||||
|
||||
// Update session
|
||||
await updateSession({
|
||||
...session,
|
||||
user: {
|
||||
...session?.user,
|
||||
image: null,
|
||||
},
|
||||
});
|
||||
|
||||
// Dispatch event to notify header to refresh profile data
|
||||
window.dispatchEvent(new Event('profile-updated'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user