Sha256: 73e44959f36780b95571dd092241822e896e75e92d89140a042be7d944d91f5b
Contents?: true
Size: 864 Bytes
Versions: 4
Compression:
Stored size: 864 Bytes
Contents
import {Component} from '@angular/core'; import {Router} from '@angular/router'; import {ICredentials, LoginService} from './login.service'; @Component({ templateUrl: './login.html' }) export class LoginComponent { creds: ICredentials; error: string; success: string; constructor( private loginService: LoginService, private router: Router ) { this.creds = {email: '', password: ''}; } doLogin (e) { e.stopPropagation(); this.error = null; this.loginService.login(this.creds) .subscribe( (json) => { this.success = 'Login successful. Redirecting...'; window.localStorage.setItem('auth_token', json.token); // this.router.navigate(['/dashboard']); // window.location.assign('/dashboard'); }, (e) => { this.error = e; } ); return false; } }
Version data entries
4 entries across 4 versions & 1 rubygems