This commit is contained in:
sdarbinyan
2026-04-14 23:14:26 +04:00
parent a15f2bca6a
commit 6e5fb3b86a
3 changed files with 78 additions and 1 deletions

View File

@@ -60,6 +60,22 @@ export class AuthService {
});
}
/** Check session without updating internal state (for polling) */
checkSessionOnce(): Observable<AuthSession | null> {
return this.http.get<AuthSession>(`${this.apiUrl}/auth/session`, {
withCredentials: true
}).pipe(
tap(session => {
if (session && session.active) {
this.sessionSignal.set(session);
this.statusSignal.set('authenticated');
this.scheduleSessionRefresh(session.expiresAt);
}
}),
catchError(() => of(null))
);
}
/**
* Called after user completes Telegram login.
* The callback URL from Telegram will hit our backend which sets the cookie.