Skip to content

Commit 1018cc7

Browse files
Merge pull request #53 from Idem-AI/dev
feat: add automatic navigation to dashboard after mobile OAuth redire…
2 parents a3f520f + b80a893 commit 1018cc7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

apps/main-dashboard/src/app/modules/auth/services/auth.service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { HttpClient } from '@angular/common/http';
22
import { inject, Injectable, forwardRef } from '@angular/core';
3+
import { Router } from '@angular/router';
34
import { TokenService } from '../../../shared/services/token.service';
45
import { CookieService } from '../../../shared/services/cookie.service';
56
import {
@@ -22,6 +23,7 @@ import { environment } from '../../../../environments/environment';
2223
})
2324
export class AuthService {
2425
private auth = inject(Auth);
26+
private router = inject(Router);
2527
user$: Observable<User | null>;
2628
private http = inject(HttpClient);
2729
private tokenService = inject(forwardRef(() => TokenService));
@@ -50,7 +52,11 @@ export class AuthService {
5052
try {
5153
const result = await getRedirectResult(this.auth);
5254
if (result?.user) {
55+
console.log('Utilisateur authentifié via redirect, traitement du login...');
5356
await this.postLogin(result.user);
57+
// Rediriger vers le dashboard après une authentification réussie
58+
console.log('Navigation vers /console après authentification mobile réussie');
59+
await this.router.navigate(['/console']);
5460
}
5561
} catch (error) {
5662
console.error('Erreur lors de la gestion du résultat de redirection:', error);

0 commit comments

Comments
 (0)