Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/ClientApp/src/app/login/login.component.ts

    ree137aa r785b8bd  
    11import { Component, OnInit } from '@angular/core';
    2 import { FormGroup, FormControl, Validators } from '@angular/forms';
    3 import { Router, ActivatedRoute } from '@angular/router';
    4 import { DataService } from '../shared/data.service';
     2import { FormBuilder, FormGroup, FormControl, Validators, FormArray } from '@angular/forms';
    53
    64@Component({
     
    119export class LoginComponent implements OnInit {
    1210  loginForm: FormGroup;
    13   email: string;
    14   passwd: string;
    15   errorMessage: string;
    1611
    17   constructor(private dataService: DataService,private router: Router, private route: ActivatedRoute) {
     12  constructor() {
    1813    this.loginForm = new FormGroup({
    1914      email: new FormControl('', [Validators.required, Validators.email]),
     
    2520  }
    2621
    27   loginPharmacyHead() {
    28     this.dataService.loginPharmacyHead(this.email, this.passwd)
    29                 .subscribe((id: Number) => {
    30                   if(id) {
    31                     this.router.navigate(['/dashboard/' + id]);
    32                   }
    33                   else {
    34                     this.errorMessage = 'There was a problem signing in!';
    35                     console.log(this.errorMessage);
    36                   }
    37                 },
    38                 (err: any) => console.log(err));
    39   }
    4022}
Note: See TracChangeset for help on using the changeset viewer.