From 4b6ad1ec3df52880dff8409b546a31635c0ea9e4 Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 27 Jun 2026 14:16:45 +0200 Subject: [PATCH] show effective account profile in sidebar --- .../app/shared/services/credential.service.ts | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/webapp/src/app/shared/services/credential.service.ts b/webapp/src/app/shared/services/credential.service.ts index ed9134fa..8e72953f 100644 --- a/webapp/src/app/shared/services/credential.service.ts +++ b/webapp/src/app/shared/services/credential.service.ts @@ -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 { - return this.httpClient - .get(`${this.apiBasePath}/api/accounts/me`, { withCredentials: true }) - .pipe(map(() => undefined)); + return this.loadCurrentProfile(); } public requestOtk(email: string, password: string): Observable { @@ -335,4 +334,19 @@ export class CredentialService { private get apiBasePath(): string { return this.apiConfiguration?.basePath ?? ''; } + + private loadCurrentProfile(): Observable { + return this.httpClient + .get(`${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), + ); + } }