diff options
Diffstat (limited to 'src/app/app-routing.module.ts')
-rw-r--r-- | src/app/app-routing.module.ts | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 7943788..e8e156d 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts | |||
@@ -11,35 +11,38 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
18 | /** | 18 | /** |
19 | * @author Philippe Buschmann | 19 | * @author Philippe Buschmann |
20 | * @file src/app/app-routing.module.ts | 20 | * @file src/app/app-routing.module.ts |
21 | * @brief | 21 | * @brief |
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | import { NgModule } from '@angular/core'; | 25 | import { NgModule } from '@angular/core'; |
26 | import { RouterModule, Routes } from '@angular/router'; | 26 | import { RouterModule, Routes, Router, ActivatedRoute, NavigationEnd } from '@angular/router'; |
27 | |||
28 | import { filter } from 'rxjs/operators'; | ||
27 | 29 | ||
28 | import { RestApisComponent } from './rest-apis/rest-apis.component'; | 30 | import { RestApisComponent } from './rest-apis/rest-apis.component'; |
29 | import { MainPageComponent } from './main-page/main-page.component'; | 31 | import { MainPageComponent } from './main-page/main-page.component'; |
30 | import { IdentityPageComponent } from './identity-page/identity-page.component'; | 32 | import { IdentityPageComponent } from './identity-page/identity-page.component'; |
31 | import { GnsPageComponent } from './gns-page/gns-page.component'; | ||
32 | import { PeerstorePageComponent } from './peerstore-page/peerstore-page.component'; | 33 | import { PeerstorePageComponent } from './peerstore-page/peerstore-page.component'; |
33 | import { NamestorePageComponent } from './namestore-page/namestore-page.component'; | 34 | import { NamestorePageComponent } from './namestore-page/namestore-page.component'; |
35 | import { ErrorPageComponent } from './error-page/error-page.component'; | ||
34 | 36 | ||
37 | import { MessagesService } from './messages.service'; | ||
35 | 38 | ||
36 | const routes: Routes = [ | 39 | const routes: Routes = [ |
37 | { path: '', component: MainPageComponent }, | 40 | { path: '', component: MainPageComponent }, |
38 | { path: 'apis', component: RestApisComponent }, | 41 | { path: 'apis', component: RestApisComponent }, |
39 | { path: 'identity', component: IdentityPageComponent }, | 42 | { path: 'identity', component: IdentityPageComponent }, |
40 | { path: 'gns', component: GnsPageComponent }, | ||
41 | { path: 'peerstore', component: PeerstorePageComponent }, | 43 | { path: 'peerstore', component: PeerstorePageComponent }, |
42 | { path: 'namestore', component: NamestorePageComponent } | 44 | { path: 'namestore', component: NamestorePageComponent }, |
45 | { path: '**', component: ErrorPageComponent } | ||
43 | ]; | 46 | ]; |
44 | 47 | ||
45 | @NgModule({ | 48 | @NgModule({ |
@@ -47,4 +50,14 @@ const routes: Routes = [ | |||
47 | exports: [ RouterModule ] | 50 | exports: [ RouterModule ] |
48 | }) | 51 | }) |
49 | export class AppRoutingModule { | 52 | export class AppRoutingModule { |
53 | constructor(private router: Router, | ||
54 | private messages: MessagesService) { | ||
55 | router.events.pipe(filter(event => event instanceof NavigationEnd)) | ||
56 | .subscribe((route: ActivatedRoute) => { | ||
57 | this.messages.dismissError(); | ||
58 | this.messages.dismissSuccess(); | ||
59 | this.messages.dismissWarning(); | ||
60 | this.messages.dismissInformation(); | ||
61 | }); | ||
62 | } | ||
50 | } | 63 | } |