Skip to content

Commit 1c1aa4c

Browse files
committed
Renamed auth guard
1 parent c376538 commit 1c1aa4c

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/app/app-routing.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule, Routes } from '@angular/router';
3-
import { AuthenticatedGuard } from './authentication/guard/authenticated.guard';
3+
import { LoggedInGuard } from './authentication/guard/logged-in.guard';
44
import { LoggedOutGuard } from './authentication/guard/logged-out.guard';
55

66
const loginModule = () => import('@app/login/login.module').then(m => m.LoginModule);
@@ -9,7 +9,7 @@ const dataModule = () => import('@app/data/data.module').then(m => m.DataModule)
99
const routes: Routes = [
1010
{ path: '', redirectTo: '/data', pathMatch: 'full' },
1111
{ path: 'login', loadChildren: loginModule, canActivate: [LoggedOutGuard] },
12-
{ path: 'data', loadChildren: dataModule, canActivate: [AuthenticatedGuard] }
12+
{ path: 'data', loadChildren: dataModule, canActivate: [LoggedInGuard] }
1313
];
1414

1515
@NgModule({

src/app/authentication/guard/authenticated.guard.spec.ts renamed to src/app/authentication/guard/logged-in.guard.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { HttpClientTestingModule } from '@angular/common/http/testing';
22
import { TestBed } from '@angular/core/testing';
33
import { RouterTestingModule } from '@angular/router/testing';
4-
import { AuthenticatedGuard } from './authenticated.guard';
4+
import { LoggedInGuard } from './logged-in.guard';
55

6-
describe('AuthenticatedGuard', () => {
7-
let guard: AuthenticatedGuard;
6+
describe('LoggedInGuard', () => {
7+
let guard: LoggedInGuard;
88

99
beforeEach(() => {
1010
TestBed.configureTestingModule({
@@ -13,7 +13,7 @@ describe('AuthenticatedGuard', () => {
1313
RouterTestingModule
1414
]
1515
});
16-
guard = TestBed.inject(AuthenticatedGuard);
16+
guard = TestBed.inject(LoggedInGuard);
1717
});
1818

1919
it('should be created', () => {

src/app/authentication/guard/authenticated.guard.ts renamed to src/app/authentication/guard/logged-in.guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { AuthenticationService } from '../service/authentication.service';
66
@Injectable({
77
providedIn: 'root'
88
})
9-
export class AuthenticatedGuard implements CanActivate {
9+
export class LoggedInGuard implements CanActivate {
1010

1111
private loginUrl = '/login';
1212

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export class User {
22
username: string = '';
33
logged: boolean = false;
4-
token: string | null = null;
4+
token: string = '';
55
}

0 commit comments

Comments
 (0)