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/auth/auth.service.ts | |
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/auth/auth.service.ts')
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 14 |
1 files changed, 10 insertions, 4 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 | ||