diff --git a/Frontend/src/app/auth/auth.guard.ts b/Frontend/src/app/auth/auth.guard.ts index 84473bb..5062588 100644 --- a/Frontend/src/app/auth/auth.guard.ts +++ b/Frontend/src/app/auth/auth.guard.ts @@ -7,14 +7,20 @@ import { AuthService } from './auth.service'; providedIn: 'root' }) export class AuthGuard { + loginUrl: string | null = null; constructor( private auth$: AuthService, - private router$: Router + private router$: Router, ) {} canActivate(): Observable | Promise | boolean | UrlTree { if (this.auth$.user && this.auth$.user.googleCredentials) { + if (this.loginUrl) { + this.router$.navigate([this.loginUrl]); + this.loginUrl = null; + } return true; } else { + this.loginUrl = window.location.pathname; this.router$.navigate(['']); return false; }