1
- import { canActivate , redirectUnauthorizedTo } from '@angular/fire/auth-guard' ;
2
1
import { NgModule } from '@angular/core' ;
3
2
import { Route , RouterModule } from '@angular/router' ;
4
3
import { AboutComponent } from './about/about.component' ;
@@ -13,9 +12,9 @@ import { TipsComponent } from './tips/tips.component';
13
12
import { TodoArchivedComponent , TodoDashboardComponent , TodoHomeComponent , TodoProjectComponent } from './todo' ;
14
13
import { TodoOutletComponent } from './todo/todo-outlet/todo-outlet.component' ;
15
14
import { UserViewerComponent } from './user-viewer/user-viewer.component' ;
16
- import { DevelopmentGuard } from './development.guard' ;
17
15
18
- const redirectUnauthorizedToLogin = redirectUnauthorizedTo ( [ 'login' ] ) ;
16
+ import { AuthGuard } from './auth.guard' ;
17
+ import { DevelopmentGuard } from './development.guard' ;
19
18
20
19
// The routes
21
20
const routes : Route [ ] = [
@@ -24,11 +23,11 @@ const routes: Route[] = [
24
23
// Account
25
24
{ path : 'account' , redirectTo : '/settings/account' } ,
26
25
// Chatrooms! Coming soon.
27
- { path : 'chats' , component : ChatsComponent , ... canActivate ( redirectUnauthorizedToLogin ) } ,
28
- { path : 'chats/explore' , component : ChatExploreComponent , ... canActivate ( redirectUnauthorizedToLogin ) } ,
29
- { path : 'chats/:id' , component : ChatViewerComponent , ... canActivate ( redirectUnauthorizedToLogin ) } ,
26
+ { path : 'chats' , component : ChatsComponent , canActivate : [ AuthGuard ] } ,
27
+ { path : 'chats/explore' , component : ChatExploreComponent , canActivate : [ AuthGuard ] } ,
28
+ { path : 'chats/:id' , component : ChatViewerComponent , canActivate : [ AuthGuard ] } ,
30
29
// Dashboard
31
- { path : 'dashboard' , component : DashboardComponent , ... canActivate ( redirectUnauthorizedToLogin ) } ,
30
+ { path : 'dashboard' , component : DashboardComponent , canActivate : [ AuthGuard ] } ,
32
31
// Downloads for the app. Currently a bit empty
33
32
{ path : 'downloads' , component : AppDownloadsComponent } ,
34
33
// Login page
@@ -42,7 +41,7 @@ const routes: Route[] = [
42
41
// Tips page.
43
42
{ path : 'tips' , component : TipsComponent } ,
44
43
{
45
- path : 'todo' , component : TodoOutletComponent , ... canActivate ( redirectUnauthorizedToLogin ) , children : [
44
+ path : 'todo' , component : TodoOutletComponent , canActivate : [ AuthGuard ] , children : [
46
45
// All todos
47
46
{ path : 'home' , component : TodoHomeComponent } ,
48
47
// Not working as of now
0 commit comments