Skip to content

Commit c3e2f3f

Browse files
committed
fix routes2
1 parent b6a7ab9 commit c3e2f3f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

frontend/ultima-ng-19.0.0/src/app/pages/home/home.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ export class HomeComponent {
6262
ngOnInit(): void {
6363
// Si déjà authentifié
6464
if (this.userService.isAuthenticated() && !this.userService.isTokenExpired()) {
65-
this.isAuthenticatedAndRedirecting.set(true); // Ajoutez cette ligne
65+
this.isAuthenticatedAndRedirecting.set(true);
66+
console.log('User is authenticated and redirecting...');
6667
const redirectUrl = this.storage.getRedirectUrl() || '/dashboards';
6768
this.router.navigate([redirectUrl]);
6869
return;
@@ -73,6 +74,7 @@ export class HomeComponent {
7374
.pipe(
7475
switchMap((params: ParamMap) => {
7576
const code = params.get('code');
77+
console.log('OAuth callback received with code:', code);
7678
if (code) {
7779
this.loading.set(true);
7880
return this.userService.validateCode$(this.formData(code));
@@ -86,14 +88,16 @@ export class HomeComponent {
8688
)
8789
.subscribe({
8890
next: (response: IAuthentication) => {
91+
console.log('Authentication successful:', response);
8992
this.saveToken(response);
90-
this.isAuthenticatedAndRedirecting.set(true); // Ajoutez cette ligne
93+
this.isAuthenticatedAndRedirecting.set(true);
9194
const redirectUrl = this.storage.getRedirectUrl() || '/dashboards';
9295
this.router.navigate([redirectUrl]);
9396
},
9497
error: (error) => {
98+
console.error('Authentication error:', error);
9599
this.loading.set(false);
96-
this.isAuthenticatedAndRedirecting.set(false); // Ajoutez cette ligne
100+
this.isAuthenticatedAndRedirecting.set(false);
97101
this.messageService.add({
98102
severity: 'error',
99103
summary: 'Authentication Failed',

0 commit comments

Comments
 (0)