fix: update header after auth via requireAuth flow

When a user authenticates through the community creation form (via
requireAuth), the header bar now re-renders to show the logged-in
state instead of still displaying the Sign In button.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-02-16 18:34:03 -07:00
parent da48f6faf6
commit 46d8429082
1 changed files with 10 additions and 1 deletions

View File

@ -433,6 +433,7 @@ interface AuthModalCallbacks {
}
let activeModal: HTMLElement | null = null;
let headerRenderFn: (() => void) | null = null;
/**
* Show the EncryptID auth modal for sign-in or registration.
@ -761,6 +762,9 @@ export function mountHeader(options: HeaderOptions): void {
});
}
// Store render function so requireAuth can update the header after auth
headerRenderFn = renderHeader;
// Mount to DOM
document.body.prepend(header);
renderHeader();
@ -775,6 +779,11 @@ export function requireAuth(onAuthenticated: () => void): boolean {
if (isAuthenticated()) {
return true;
}
showAuthModal({ onSuccess: onAuthenticated });
showAuthModal({
onSuccess: () => {
headerRenderFn?.();
onAuthenticated();
},
});
return false;
}