diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-27 16:14:11 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-27 16:14:11 +0100 |
commit | 7ddd02c9b8c1e088f6679a2227f105e6439fc992 (patch) | |
tree | a1ff7af17f2a95abe85a2380834957e44032e8c2 /client/src/app/core | |
parent | cddadde81f91219204cec1f4057a191c02a70894 (diff) | |
download | PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.tar.gz PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.tar.zst PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.zip |
Client: better notifications for a beautiful world
Diffstat (limited to 'client/src/app/core')
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 14 | ||||
-rw-r--r-- | client/src/app/core/core.module.ts | 8 |
2 files changed, 17 insertions, 5 deletions
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 06ffa1a42..a56adbbad 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -7,6 +7,8 @@ import 'rxjs/add/operator/map'; | |||
7 | import 'rxjs/add/operator/mergeMap'; | 7 | import 'rxjs/add/operator/mergeMap'; |
8 | import 'rxjs/add/observable/throw'; | 8 | import 'rxjs/add/observable/throw'; |
9 | 9 | ||
10 | import { NotificationsService } from 'angular2-notifications'; | ||
11 | |||
10 | // Do not use the barrel (dependency loop) | 12 | // Do not use the barrel (dependency loop) |
11 | import { AuthStatus } from '../../shared/auth/auth-status.model'; | 13 | import { AuthStatus } from '../../shared/auth/auth-status.model'; |
12 | import { AuthUser } from '../../shared/auth/auth-user.model'; | 14 | import { AuthUser } from '../../shared/auth/auth-user.model'; |
@@ -27,6 +29,7 @@ export class AuthService { | |||
27 | 29 | ||
28 | constructor( | 30 | constructor( |
29 | private http: Http, | 31 | private http: Http, |
32 | private notificationsService: NotificationsService, | ||
30 | private restExtractor: RestExtractor, | 33 | private restExtractor: RestExtractor, |
31 | private router: Router | 34 | private router: Router |
32 | ) { | 35 | ) { |
@@ -44,11 +47,14 @@ export class AuthService { | |||
44 | this.clientSecret = result.client_secret; | 47 | this.clientSecret = result.client_secret; |
45 | console.log('Client credentials loaded.'); | 48 | console.log('Client credentials loaded.'); |
46 | }, | 49 | }, |
50 | |||
47 | error => { | 51 | error => { |
48 | alert( | 52 | let errorMessage = `Cannot retrieve OAuth Client credentials: ${error.text}. \n`; |
49 | `Cannot retrieve OAuth Client credentials: ${error.text}. \n` + | 53 | errorMessage += 'Ensure you have correctly configured PeerTube (config/ directory), in particular the "webserver" section.'; |
50 | 'Ensure you have correctly configured PeerTube (config/ directory), in particular the "webserver" section.' | 54 | |
51 | ); | 55 | // We put a bigger timeout |
56 | // This is an important message | ||
57 | this.notificationsService.error('Error', errorMessage, { timeOut: 7000 }); | ||
52 | } | 58 | } |
53 | ); | 59 | ); |
54 | 60 | ||
diff --git a/client/src/app/core/core.module.ts b/client/src/app/core/core.module.ts index 09a6f92f5..48fec2d43 100644 --- a/client/src/app/core/core.module.ts +++ b/client/src/app/core/core.module.ts | |||
@@ -3,6 +3,8 @@ import { CommonModule } from '@angular/common'; | |||
3 | import { HttpModule } from '@angular/http'; | 3 | import { HttpModule } from '@angular/http'; |
4 | import { RouterModule } from '@angular/router'; | 4 | import { RouterModule } from '@angular/router'; |
5 | 5 | ||
6 | import { SimpleNotificationsModule } from 'angular2-notifications'; | ||
7 | |||
6 | import { AuthService } from './auth'; | 8 | import { AuthService } from './auth'; |
7 | import { MenuComponent, MenuAdminComponent } from './menu'; | 9 | import { MenuComponent, MenuAdminComponent } from './menu'; |
8 | import { throwIfAlreadyLoaded } from './module-import-guard'; | 10 | import { throwIfAlreadyLoaded } from './module-import-guard'; |
@@ -11,13 +13,17 @@ import { throwIfAlreadyLoaded } from './module-import-guard'; | |||
11 | imports: [ | 13 | imports: [ |
12 | CommonModule, | 14 | CommonModule, |
13 | HttpModule, | 15 | HttpModule, |
14 | RouterModule | 16 | RouterModule, |
17 | |||
18 | SimpleNotificationsModule | ||
15 | ], | 19 | ], |
16 | declarations: [ | 20 | declarations: [ |
17 | MenuComponent, | 21 | MenuComponent, |
18 | MenuAdminComponent | 22 | MenuAdminComponent |
19 | ], | 23 | ], |
20 | exports: [ | 24 | exports: [ |
25 | SimpleNotificationsModule, | ||
26 | |||
21 | MenuComponent, | 27 | MenuComponent, |
22 | MenuAdminComponent | 28 | MenuAdminComponent |
23 | ], | 29 | ], |