import { Component , OnInit } from '@angular/core' ; import { AccountService } from "../../services/account.service" ; import { Router } from "@angular/router" ; import * as _ from "lodash" ; import { ContextService } from "../../services/context.service" ; import { UsersService } from "../../services/users/users.service" ; @ Component ( { selector : 'app-login-modal' , templateUrl : './login-modal.component.html' , styleUrls : [ './login-modal.component.scss' ] } ) export class LoginModalComponent { public userId ; public password ; public throwError = false ; public showLoader = false ; constructor ( private userService , private context , private router ) { } login ( ) { console . log ( this . userId , this . password ) ; this . showLoader = true ; this . userService . authorizeUser ( this . userId , this . password ) . then ( ( response ) => { if ( response ) { console . log ( this . userId , response ) ; this . context . setLoginCredentials ( this . userId , response ) ; this . router . navigate ( [ '/base/home/my-groups-section' ] ) ; } else { this . throwError = true ; } this . showLoader = false ; } ) . catch ( ( ) => { this . showLoader = false ; } ) ; } forgotPasswordLink ( ) { this . router . navigate ( [ '/base/start/forgot-password' ] ) ; } createAccountLink ( ) { this . router . navigate ( [ '/base/start/create-account' ] ) ; } }