diff --git a/bizmatch/src/app/pages/details/details-business-listing/details-business-listing.component.html b/bizmatch/src/app/pages/details/details-business-listing/details-business-listing.component.html index c1a80ad..5ac7472 100644 --- a/bizmatch/src/app/pages/details/details-business-listing/details-business-listing.component.html +++ b/bizmatch/src/app/pages/details/details-business-listing/details-business-listing.component.html @@ -31,10 +31,11 @@ {{ listingUser.firstname }} {{ listingUser.lastname }} - Business logo for {{ listingUser.firstname }} {{ listingUser.lastname }} +
+ Business logo for {{ listingUser.firstname }} {{ listingUser.lastname }} +
diff --git a/bizmatch/src/app/pages/details/details-commercial-property-listing/details-commercial-property-listing.component.html b/bizmatch/src/app/pages/details/details-commercial-property-listing/details-commercial-property-listing.component.html index 04f880d..65f2cb3 100644 --- a/bizmatch/src/app/pages/details/details-commercial-property-listing/details-commercial-property-listing.component.html +++ b/bizmatch/src/app/pages/details/details-commercial-property-listing/details-commercial-property-listing.component.html @@ -32,10 +32,11 @@ {{ detail.user.firstname }} {{ detail.user.lastname }} - Company logo for {{ detail.user.firstname }} {{ detail.user.lastname }} +
+ Company logo for {{ detail.user.firstname }} {{ detail.user.lastname }} +
diff --git a/bizmatch/src/app/pages/details/details-user/details-user.component.html b/bizmatch/src/app/pages/details/details-user/details-user.component.html index a877279..67a1a01 100644 --- a/bizmatch/src/app/pages/details/details-user/details-user.component.html +++ b/bizmatch/src/app/pages/details/details-user/details-user.component.html @@ -35,8 +35,10 @@

@if(user.hasCompanyLogo){ - Company logo of {{ user.companyName }} +
+ Company logo of {{ user.companyName }} +
} diff --git a/bizmatch/src/app/services/auth.service.ts b/bizmatch/src/app/services/auth.service.ts index 307ab80..25663cd 100644 --- a/bizmatch/src/app/services/auth.service.ts +++ b/bizmatch/src/app/services/auth.service.ts @@ -183,11 +183,8 @@ export class AuthService { return Promise.resolve(); } isAdmin(): Observable { - return this.getUserRole().pipe( + return this.userRole$.pipe( map(role => role === 'admin'), - // take(1) ist optional - es beendet die Subscription, nachdem ein Wert geliefert wurde - // Nützlich, wenn du die Methode in einem Template mit dem async pipe verwendest - take(1), ); } // Get current user's role from the server with caching @@ -196,6 +193,9 @@ export class AuthService { // Cache zurücksetzen, wenn die Caching-Zeit abgelaufen ist oder kein Cache existiert if (!this.cachedUserRole$ || now - this.lastCacheTime > this.cacheDuration) { + if (!this.getLocalStorageItem('authToken')) { + return of(null); + } this.lastCacheTime = now; let headers = new HttpHeaders().set('X-Hide-Loading', 'true').set('Accept-Language', 'en-US'); this.cachedUserRole$ = this.http.get<{ role: UserRole | null }>(`${environment.apiBaseUrl}/bizmatch/auth/me/role`, { headers }).pipe(