Configure ESLint with deprecation checking and fix all lint violations
This commit is contained in:
1 parent
bdc2e1bc57
commit
fd2019e3cd
8 files changed
+331
-48
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { Component, signal } from '@angular/core';
|
||||
import { Component, signal, inject } from '@angular/core';
|
||||
import { OAuthService } from 'angular-oauth2-oidc';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
|
||||
@@ -12,21 +12,22 @@ export class App {
|
||||
protected readonly title = signal('LMNP Organizer');
|
||||
readonly helloMessage = signal<string>('');
|
||||
|
||||
constructor(private oauthService: OAuthService, private http: HttpClient) {}
|
||||
private readonly oauthService = inject(OAuthService);
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
get isLoggedIn(): boolean {
|
||||
return this.oauthService.hasValidAccessToken();
|
||||
}
|
||||
|
||||
get username(): string {
|
||||
const claims: any = this.oauthService.getIdentityClaims();
|
||||
const claims = this.oauthService.getIdentityClaims() as Record<string, string> | null;
|
||||
if (!claims) return '';
|
||||
return claims.preferred_username || claims.given_name || claims.name || 'User';
|
||||
return claims['preferred_username'] || claims['given_name'] || claims['name'] || 'User';
|
||||
}
|
||||
|
||||
get email(): string {
|
||||
const claims: any = this.oauthService.getIdentityClaims();
|
||||
return claims?.email || '';
|
||||
const claims = this.oauthService.getIdentityClaims() as Record<string, string> | null;
|
||||
return claims ? claims['email'] : '';
|
||||
}
|
||||
|
||||
login() {
|
||||
@@ -34,7 +35,7 @@ export class App {
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.oauthService.logOut();
|
||||
this.oauthService.revokeTokenAndLogout();
|
||||
}
|
||||
|
||||
callHelloApi() {
|
||||
|
||||
Reference in new issue
Block a user