aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/app/users/login/login.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/app/users/login/login.component.ts')
-rw-r--r--client/app/users/login/login.component.ts37
1 files changed, 0 insertions, 37 deletions
diff --git a/client/app/users/login/login.component.ts b/client/app/users/login/login.component.ts
deleted file mode 100644
index 09c5f1af7..000000000
--- a/client/app/users/login/login.component.ts
+++ /dev/null
@@ -1,37 +0,0 @@
1import { Component } from '@angular/core';
2import { Router } from '@angular/router-deprecated';
3
4import { AuthService, AuthStatus, User } from '../shared/index';
5
6@Component({
7 selector: 'my-user-login',
8 styleUrls: [ 'client/app/users/login/login.component.css' ],
9 templateUrl: 'client/app/users/login/login.component.html'
10})
11
12export class UserLoginComponent {
13 constructor(
14 private authService: AuthService,
15 private router: Router
16 ) {}
17
18 login(username: string, password: string) {
19 this.authService.login(username, password).subscribe(
20 result => {
21 const user = new User(username, result);
22 user.save();
23
24 this.authService.setStatus(AuthStatus.LoggedIn);
25
26 this.router.navigate(['VideosList']);
27 },
28 error => {
29 if (error.error === 'invalid_grant') {
30 alert('Credentials are invalid.');
31 } else {
32 alert(`${error.error}: ${error.error_description}`);
33 }
34 }
35 );
36 }
37}