Angular app for CAC desktop
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

35 строки
867 B

  1. import { Component, OnInit } from '@angular/core';
  2. import { Router } from '@angular/router';
  3. import { AuthService } from '../services/auth.service';
  4. @Component({
  5. selector: 'app-login',
  6. templateUrl: './login.component.html',
  7. styleUrls: ['./login.component.scss']
  8. })
  9. export class LoginComponent implements OnInit {
  10. credentails: {
  11. username: string,
  12. password: string,
  13. } = {
  14. username: 'admin@catalysts.org',
  15. password: '1234'
  16. };
  17. constructor(
  18. private router: Router,
  19. private authService: AuthService
  20. ) { }
  21. ngOnInit(): void {
  22. }
  23. login() {
  24. this.authService.authenticateUser(this.credentails).then((data: any) => {
  25. localStorage.setItem('token', data.token);
  26. this.router.navigate(['/dashboard/analytics']);
  27. }, (e) => console.log(e));
  28. }
  29. }