|
12345678910111213141516171819202122232425262728293031323334 |
- import { Component, OnInit } from '@angular/core';
- import { Router } from '@angular/router';
- import { AuthService } from '../services/auth.service';
-
- @Component({
- selector: 'app-login',
- templateUrl: './login.component.html',
- styleUrls: ['./login.component.scss']
- })
- export class LoginComponent implements OnInit {
- credentails: {
- username: string,
- password: string,
- } = {
- username: 'admin@catalysts.org',
- password: '1234'
- };
-
- constructor(
- private router: Router,
- private authService: AuthService
- ) { }
-
- ngOnInit(): void {
- }
-
- login() {
- this.authService.authenticateUser(this.credentails).then((data: any) => {
- localStorage.setItem('token', data.token);
- this.router.navigate(['/dashboard/analytics']);
- }, (e) => console.log(e));
- }
-
- }
|