Skip to content

Commit b01dceb

Browse files
committed
Init guards
Used ng generate guard to generate these.
1 parent ac136c6 commit b01dceb

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { TestBed } from '@angular/core/testing';
2+
import { CanActivateFn } from '@angular/router';
3+
4+
import { userOnlyGuard } from './user-only.guard';
5+
6+
describe('userOnlyGuard', () => {
7+
const executeGuard: CanActivateFn = (...guardParameters) =>
8+
TestBed.runInInjectionContext(() => userOnlyGuard(...guardParameters));
9+
10+
beforeEach(() => {
11+
TestBed.configureTestingModule({});
12+
});
13+
14+
it('should be created', () => {
15+
expect(executeGuard).toBeTruthy();
16+
});
17+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { CanActivateFn } from '@angular/router';
2+
3+
export const userOnlyGuard: CanActivateFn = (route, state) => {
4+
return true;
5+
};

frontend/src/_services/authentication.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Modified from https://jasonwatmore.com/post/2022/11/15/angular-14-jwt-authentication-example-tutorial#login-component-ts
12
import { Injectable } from '@angular/core';
23
import { Router } from '@angular/router';
34
import { HttpClient } from '@angular/common/http';

0 commit comments

Comments
 (0)