wip
This commit is contained in:
parent
8b2d8f7e05
commit
f797092d38
11 changed files with 226 additions and 216 deletions
|
@ -1,7 +1,6 @@
|
|||
import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core';
|
||||
import { UserService } from '../../service/user.service';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import { Router } from '@angular/router';
|
||||
import { AuthService } from '../../service/auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login-success',
|
||||
|
@ -12,15 +11,10 @@ import { Router } from '@angular/router';
|
|||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export default class LoginSuccessComponent implements OnInit {
|
||||
private userService: UserService = inject(UserService);
|
||||
private keycloakService: KeycloakService = inject(KeycloakService);
|
||||
private router: Router = inject(Router);
|
||||
|
||||
private authService: AuthService = inject(AuthService);
|
||||
async ngOnInit() {
|
||||
const userProfile = await this.keycloakService.loadUserProfile();
|
||||
const user = await this.userService.getOrCreateUser(userProfile);
|
||||
sessionStorage.setItem('user', JSON.stringify(user));
|
||||
|
||||
this.router.navigate(['home']);
|
||||
console.log(this.authService.getAccessToken());
|
||||
(this.authService.getUserInfo().then(console.log));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue