diff --git a/src/app/auth.guard.ts b/src/app/auth.guard.ts index d97f993..eaa0597 100644 --- a/src/app/auth.guard.ts +++ b/src/app/auth.guard.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; import { CanActivate, Router } from '@angular/router'; import { LocalStorageService } from './services/localstorage.service'; +import { LoginModalService } from './services/login-modal.service'; @Injectable({ providedIn: 'root', @@ -8,7 +9,8 @@ import { LocalStorageService } from './services/localstorage.service'; export class AuthGuard implements CanActivate { constructor( private localStorageService: LocalStorageService, - private router: Router + private router: Router, + private loginModalService: LoginModalService ) {} canActivate(): boolean { @@ -16,7 +18,8 @@ export class AuthGuard implements CanActivate { if (token) { return true; } else { - this.router.navigate(['?sign']); + this.loginModalService.openModal(); + this.router.navigate(['/']); return false; } } diff --git a/src/app/components/home-page/home-page.component.html b/src/app/components/home-page/home-page.component.html index 772d2e5..8524716 100644 --- a/src/app/components/home-page/home-page.component.html +++ b/src/app/components/home-page/home-page.component.html @@ -46,7 +46,7 @@ important.