Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getUser() {
- this.user.login_user(this.loginResult.username, this.loginResult.password)
- .then(results => {
- this.results = results
- localStorage.setItem('token_user', this.results.token);
- this.analytics.emitEvent("Login con usuario y clave", "login", this.username, 100)
- this.user.getClient().then(res => {
- this.clientprofile.orderCurrent().then(resp => {
- }).catch(err => {
- this.analytics.emitEvent(err, "Login.Componet", "/client_profile/orders/current", 100)
- })
- localStorage.setItem('current_sector', this.user.Profile.current_sector.city.name)
- localStorage.setItem('current_city', this.user.Profile.current_sector.name)
- localStorage.setItem('modal', "1");
- this.router.navigate(['/inicio']);
- }).catch(error => {
- this.analytics.emitEvent(error, "Login.Componet", "/client_profile/", 100)
- })
- })
- .catch(err => {
- this.analytics.emitEvent(err, "Login.Componet", "/api-token-auth/", 100)
- this.loading = false
- this.onAlert({ loginRes: 'Usuario o Contraseña incorrecta.', iconUrl: '/assets/img/icons3-42.svg' })
- })
- }
- import { Component, OnInit } from '@angular/core';
- import { Router, NavigationEnd } from '@angular/router'
- import { ClientprofileService } from
- '../servicios/clientprofile.service'
- import { UtilService } from '../servicios/util.service'
- @Component({
- selector: 'app-header-landing',
- templateUrl: './header-landing.component.html',
- styleUrls: ['./header-landing.component.css']
- })
- export class HeaderLandingComponent implements OnInit {
- constructor(
- public router: Router,
- public clientprofile: ClientprofileService,
- public util: UtilService,
- ) {
- }
- ngOnInit() {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement