feat: Redirect authenticated users from auth pages and enable event-driven profile data refresh in the settings sidebar.

This commit is contained in:
pradeepkumar
2026-02-09 00:03:45 +05:30
parent a2384fc7d9
commit eefc4bcd78
3 changed files with 109 additions and 54 deletions

View File

@@ -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'));