diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-06-03 22:08:03 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-06-03 22:08:03 +0200 |
commit | 4a6995be18b15de1834a39c8921a0e4109671bb6 (patch) | |
tree | b659661cea33687fcc6bd8fc2251cb7a15ab9f9d /client/app/login/login.component.ts | |
parent | 468892541175f9662f8b1b977e819dc1a496f282 (diff) | |
download | PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.tar.gz PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.tar.zst PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.zip |
First draft to use webpack instead of systemjs
Diffstat (limited to 'client/app/login/login.component.ts')
-rw-r--r-- | client/app/login/login.component.ts | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/client/app/login/login.component.ts b/client/app/login/login.component.ts deleted file mode 100644 index 50f598d92..000000000 --- a/client/app/login/login.component.ts +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | import { Component } from '@angular/core'; | ||
2 | import { Router } from '@angular/router-deprecated'; | ||
3 | |||
4 | import { AuthService, AuthStatus, User } from '../shared/index'; | ||
5 | |||
6 | @Component({ | ||
7 | selector: 'my-login', | ||
8 | templateUrl: 'client/app/login/login.component.html' | ||
9 | }) | ||
10 | |||
11 | export class LoginComponent { | ||
12 | constructor( | ||
13 | private authService: AuthService, | ||
14 | private router: Router | ||
15 | ) {} | ||
16 | |||
17 | login(username: string, password: string) { | ||
18 | this.authService.login(username, password).subscribe( | ||
19 | result => { | ||
20 | const user = new User(username, result); | ||
21 | user.save(); | ||
22 | |||
23 | this.authService.setStatus(AuthStatus.LoggedIn); | ||
24 | |||
25 | this.router.navigate(['VideosList']); | ||
26 | }, | ||
27 | error => { | ||
28 | if (error.error === 'invalid_grant') { | ||
29 | alert('Credentials are invalid.'); | ||
30 | } else { | ||
31 | alert(`${error.error}: ${error.error_description}`); | ||
32 | } | ||
33 | } | ||
34 | ); | ||
35 | } | ||
36 | } | ||