Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. getUser() {
  2. this.user.login_user(this.loginResult.username, this.loginResult.password)
  3. .then(results => {
  4. this.results = results
  5. localStorage.setItem('token_user', this.results.token);
  6. this.analytics.emitEvent("Login con usuario y clave", "login", this.username, 100)
  7. this.user.getClient().then(res => {
  8. this.clientprofile.orderCurrent().then(resp => {
  9. }).catch(err => {
  10. this.analytics.emitEvent(err, "Login.Componet", "/client_profile/orders/current", 100)
  11. })
  12. localStorage.setItem('current_sector', this.user.Profile.current_sector.city.name)
  13. localStorage.setItem('current_city', this.user.Profile.current_sector.name)
  14. localStorage.setItem('modal', "1");
  15. this.router.navigate(['/inicio']);
  16. }).catch(error => {
  17. this.analytics.emitEvent(error, "Login.Componet", "/client_profile/", 100)
  18. })
  19. })
  20. .catch(err => {
  21. this.analytics.emitEvent(err, "Login.Componet", "/api-token-auth/", 100)
  22. this.loading = false
  23. this.onAlert({ loginRes: 'Usuario o Contraseña incorrecta.', iconUrl: '/assets/img/icons3-42.svg' })
  24. })
  25. }
  26.  
  27. import { Component, OnInit } from '@angular/core';
  28. import { Router, NavigationEnd } from '@angular/router'
  29. import { ClientprofileService } from
  30. '../servicios/clientprofile.service'
  31. import { UtilService } from '../servicios/util.service'
  32.  
  33. @Component({
  34. selector: 'app-header-landing',
  35. templateUrl: './header-landing.component.html',
  36. styleUrls: ['./header-landing.component.css']
  37. })
  38. export class HeaderLandingComponent implements OnInit {
  39.  
  40. constructor(
  41. public router: Router,
  42. public clientprofile: ClientprofileService,
  43. public util: UtilService,
  44. ) {
  45. }
  46.  
  47. ngOnInit() {
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement