|
1 | | -import {NgModule} from '@angular/core'; |
2 | | -import {BrowserModule} from '@angular/platform-browser'; |
3 | | -import {AppComponent} from './app.component'; |
| 1 | +import { NgModule } from '@angular/core'; |
| 2 | +import { BrowserModule } from '@angular/platform-browser'; |
| 3 | +import { AppComponent } from './app.component'; |
4 | 4 | //tag::importAngularSDK[] |
5 | | -import {FusionAuthModule} from "@fusionauth/angular-sdk"; |
| 5 | +import { FusionAuthModule } from '@fusionauth/angular-sdk'; |
6 | 6 | //end::importAngularSDK[] |
7 | 7 | //tag::importAuthGuard[] |
8 | | -import {RouterModule} from "@angular/router"; |
9 | | -import {authGuard} from "./auth-guard"; |
| 8 | +import { RouterModule } from '@angular/router'; |
| 9 | +import { authGuard } from './auth-guard'; |
10 | 10 | //end::importAuthGuard[] |
11 | 11 |
|
12 | 12 | @NgModule({ |
13 | | - declarations: [ |
14 | | - AppComponent |
15 | | - ], |
| 13 | + declarations: [AppComponent], |
16 | 14 | imports: [ |
17 | 15 | BrowserModule, |
18 | 16 | //tag::routerConfiguration[] |
19 | 17 | RouterModule.forRoot([ |
20 | | - {path: '', loadComponent: () => import('./home-page/home-page.component').then(m => m.HomePageComponent), canActivate: [authGuard(false, '/account')]}, |
21 | | - {path: 'account', loadComponent: () => import('./account-page/account-page.component').then(m => m.AccountPageComponent), canActivate: [authGuard(true, '/')]}, |
22 | | - {path: 'make-change', loadComponent: () => import('./make-change-page/make-change-page.component').then(m => m.MakeChangePageComponent), canActivate: [authGuard(true, '/')]}, |
| 18 | + { |
| 19 | + path: '', |
| 20 | + loadComponent: () => |
| 21 | + import('./home-page/home-page.component').then( |
| 22 | + (m) => m.HomePageComponent |
| 23 | + ), |
| 24 | + canActivate: [authGuard(false, '/account')], |
| 25 | + }, |
| 26 | + { |
| 27 | + path: 'account', |
| 28 | + loadComponent: () => |
| 29 | + import('./account-page/account-page.component').then( |
| 30 | + (m) => m.AccountPageComponent |
| 31 | + ), |
| 32 | + canActivate: [authGuard(true, '/')], |
| 33 | + }, |
| 34 | + { |
| 35 | + path: 'make-change', |
| 36 | + loadComponent: () => |
| 37 | + import('./make-change-page/make-change-page.component').then( |
| 38 | + (m) => m.MakeChangePageComponent |
| 39 | + ), |
| 40 | + canActivate: [authGuard(true, '/')], |
| 41 | + }, |
23 | 42 | ]), |
24 | 43 | //end::routerConfiguration[] |
25 | 44 | //tag::fusionAuthModuleConfiguration[] |
26 | 45 | FusionAuthModule.forRoot({ |
27 | 46 | clientId: 'e9fdb985-9173-4e01-9d73-ac2d60d1dc8e', |
28 | 47 | serverUrl: 'http://localhost:9011', |
29 | 48 | redirectUri: 'http://localhost:4200', |
| 49 | + scope: 'openid email profile offline_access', |
| 50 | + shouldAutoRefresh: true, |
30 | 51 | }), |
31 | 52 | //end::fusionAuthModuleConfiguration[] |
32 | 53 | ], |
33 | 54 | providers: [], |
34 | | - bootstrap: [AppComponent] |
| 55 | + bootstrap: [AppComponent], |
35 | 56 | }) |
36 | | -export class AppModule { |
37 | | -} |
| 57 | +export class AppModule {} |
0 commit comments