AI Implementation feature(881): Authenticated Shell, Quick Tabs and Change Password 1.05 (#20)

This commit was merged in pull request #20.
This commit is contained in:
2026-07-22 10:35:27 +00:00
parent 90e570c43c
commit de527ec6d6
15 changed files with 688 additions and 56 deletions
@@ -129,11 +129,21 @@ export class HomeComponent implements OnInit, OnDestroy {
ngOnInit(): void {
this.userStore.hydrateFromAuth();
void this.userStore.loadMe();
this.eventStatus.start(() => this.authenticatedEventSource.open('/api/v1/events/status'));
this.eventStatus.start(
() => this.authenticatedEventSource.open('/api/v1/events/status'),
() => this.handleSessionInvalidated('sse-unauthorized'),
);
this.peerInvalidationUnsubscribe = this.auth.onPeerInvalidation((reason) =>
this.handleSessionInvalidated(reason),
);
}
ngOnDestroy(): void {
this.eventStatus.stop();
if (this.peerInvalidationUnsubscribe) {
this.peerInvalidationUnsubscribe();
this.peerInvalidationUnsubscribe = null;
}
}
goHome(): void {
@@ -192,4 +202,23 @@ export class HomeComponent implements OnInit, OnDestroy {
this.userStore.reset();
await this.router.navigateByUrl('/login');
}
private peerInvalidationUnsubscribe: (() => void) | null = null;
private navigatingToLogin = false;
private async handleSessionInvalidated(
_reason: 'peer-logout' | 'sse-unauthorized',
): Promise<void> {
this.userStore.reset();
this.changePasswordOpen.set(false);
this.userMenuOpen.set(false);
if (this.navigatingToLogin) return;
if (this.router.url.startsWith('/login')) return;
this.navigatingToLogin = true;
try {
await this.router.navigateByUrl('/login');
} finally {
this.navigatingToLogin = false;
}
}
}