show effective account profile in sidebar
LocationBasedServices/smartguide/pipeline/head This commit looks good

This commit is contained in:
Roman
2026-06-27 14:16:45 +02:00
parent 0648e1774c
commit 4b6ad1ec3d
@@ -15,6 +15,7 @@ import {
Configuration,
IdToken,
LoginResponse,
AccountProfile,
} from '../../api';
import { HttpClient, HttpHeaders } from '@angular/common/http';
@@ -76,9 +77,7 @@ export class CredentialService {
}
public validateCurrentSession(): Observable<void> {
return this.httpClient
.get(`${this.apiBasePath}/api/accounts/me`, { withCredentials: true })
.pipe(map(() => undefined));
return this.loadCurrentProfile();
}
public requestOtk(email: string, password: string): Observable<string> {
@@ -335,4 +334,19 @@ export class CredentialService {
private get apiBasePath(): string {
return this.apiConfiguration?.basePath ?? '';
}
private loadCurrentProfile(): Observable<void> {
return this.httpClient
.get<AccountProfile>(`${this.apiBasePath}/api/accounts/me`, {
withCredentials: true,
})
.pipe(
tap((profile) => {
this.login.next(profile.name ?? profile.email ?? '');
this.email.next(profile.email ?? '');
this.organizationName.next(profile.organization_name ?? '');
}),
map(() => undefined),
);
}
}