fix: login page reload + custom logout dialog

1. Login fix:
   - Added window.location.reload() after setting hash URL
   - Forces full page reload to refresh cookies from server
   - Resolves 'Cookie check failed' error after login

2. Logout UX improvement:
   - Created alert-dialog.tsx component (Radix UI AlertDialog)
   - Replaced window.confirm() with custom AlertDialog
   - Dialog shows: title, description, Cancel/Log Out buttons
   - Red 'Log Out' action button for clear intent
This commit is contained in:
Dwindi Ramadhana
2026-01-01 17:08:34 +07:00
parent c83ea78911
commit 508ec682a7
3 changed files with 190 additions and 14 deletions

View File

@@ -56,8 +56,12 @@ export default function Login() {
toast.success('Login successful!');
// Full page reload to refresh nonce and user state
window.location.href = window.location.origin + '/store/#' + redirectTo;
// Set the target URL with hash route, then force reload
// The hash change alone doesn't reload the page, so cookies won't be refreshed
const targetUrl = window.location.origin + '/store/#' + redirectTo;
window.location.href = targetUrl;
// Force page reload to refresh cookies and server-side state
window.location.reload();
} else {
setError(data.message || 'Login failed');
}