dev env setup
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { effect, inject, Injectable, signal } from '@angular/core';
|
||||
import { computed, effect, inject, Injectable, signal } from '@angular/core';
|
||||
import {
|
||||
KEYCLOAK_EVENT_SIGNAL,
|
||||
KeycloakEventType,
|
||||
@@ -22,6 +22,9 @@ export class Authentication {
|
||||
private readonly _authenticationState = signal<AuthenticationState>(AuthenticationState.Unknown);
|
||||
private readonly _userInfo = signal<KeycloakProfile | null>(null);
|
||||
public readonly authenticationState = this._authenticationState.asReadonly();
|
||||
public readonly loggedIn = computed(()=>{
|
||||
return this.authenticationState() === AuthenticationState.Authenticated;
|
||||
});
|
||||
public readonly userInfo = this._userInfo.asReadonly();
|
||||
|
||||
public constructor() {
|
||||
@@ -69,6 +72,10 @@ export class Authentication {
|
||||
}
|
||||
|
||||
public async login(location?: string): Promise<void> {
|
||||
if(this._authenticationState() === AuthenticationState.Authenticated){
|
||||
return;
|
||||
}
|
||||
|
||||
var redirectUri = location
|
||||
? `${window.location.origin}/${location}`
|
||||
: `${window.location.origin}/login`;
|
||||
|
||||
Reference in New Issue
Block a user