Last change
on this file was baf4cc4, checked in by ppaunovski <paunovskipavel@…>, 3 months ago |
split group project and individual project into two separate folders
|
-
Property mode
set to
100644
|
File size:
410 bytes
|
Line | |
---|
1 | import {CanActivateFn, Router} from '@angular/router';
|
---|
2 | import {inject} from "@angular/core";
|
---|
3 | import {AuthService} from "../services/auth/auth.service";
|
---|
4 |
|
---|
5 | export const authCanmatchGuard: CanActivateFn = (route, state) => {
|
---|
6 | let service = inject(AuthService);
|
---|
7 | let router = inject(Router)
|
---|
8 | if (service.isAuthenticated()) {
|
---|
9 | return true;
|
---|
10 | }
|
---|
11 | else {
|
---|
12 | router.navigate(['/login'])
|
---|
13 | return false;
|
---|
14 | }
|
---|
15 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.