fix: restore HTML login form with prerender: true per spec requirements
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m24s

Context: Validation script requires Login.razor to use prerender: true for
immediate form display before WASM boots (Phase 9 requirement).

Solution: Revert to original HTML form + JavaScript approach:
- AdminLoginForm: HTML form (statically rendered, works with prerender: true)
- admin-session.js: JavaScript login handler
- Post-login: 200ms delay before redirect to allow CustomAuthenticationStateProvider
  to read tokens from localStorage and establish auth state

Flow:
1. User submits form (JavaScript handles it)
2. POST /api/auth/login
3. Save tokens to localStorage
4. 200ms delay
5. Redirect to /taxbaik/admin/dashboard
6. Page loads with Blazor bootstrapping + auth state restored

Result: Login form displays immediately (prerender: true) while maintaining
proper authentication state propagation for [Authorize] pages.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 13:13:23 +09:00
parent da6058fb61
commit d3b9a6047c
3 changed files with 49 additions and 106 deletions
+5 -4
View File
@@ -341,10 +341,11 @@ window.taxbaikAdminSession = {
localStorage.removeItem('admin-remember-checkbox');
}
// 토큰 저장한 직후 페이지 리로드
// 이렇게 하면 CustomAuthenticationStateProvider의 GetAuthenticationStateAsync()가
// localStorage에서 토큰을 복원하고 [Authorize] 페이지가 제대로 렌더링됨
window.location.href = '/taxbaik/admin/dashboard';
// 토큰 저장 후 약간의 지연을 두고 대시보드로 이동
// 이렇게 하면 CustomAuthenticationStateProvider가 localStorage에서 토큰을 복원할 시간이 생김
setTimeout(() => {
window.location.href = '/taxbaik/admin/dashboard';
}, 200);
} catch (error) {
window.taxbaikAdminSession.traceUiState('admin-login', `submit failed: ${error?.message || 'login failed'}`);
postLog({