[8423429] | 1 | import { Component } from '@angular/core';
|
---|
| 2 | import {LoginService} from "../login.service";
|
---|
| 3 | import {ActiveUserInterface} from "../ActiveUserInterface";
|
---|
| 4 | import {Router} from "@angular/router";
|
---|
| 5 | import {RegisterService} from "../register.service";
|
---|
| 6 |
|
---|
| 7 | @Component({
|
---|
| 8 | selector: 'app-login',
|
---|
| 9 | templateUrl: './login.component.html',
|
---|
| 10 | styleUrls: ['./login.component.css']
|
---|
| 11 | })
|
---|
| 12 | export class LoginComponent {
|
---|
| 13 | name:string|undefined;
|
---|
| 14 | lastName:string|undefined;
|
---|
| 15 | email:string|undefined;
|
---|
| 16 | username:string|undefined;
|
---|
| 17 | password:string|undefined;
|
---|
| 18 | userType:string|undefined;
|
---|
| 19 | index:string|undefined;
|
---|
| 20 | activeUser: ActiveUserInterface | undefined;
|
---|
| 21 | login: boolean | undefined;
|
---|
| 22 | register: boolean | undefined;
|
---|
| 23 |
|
---|
| 24 | constructor(private service: LoginService, private registerService: RegisterService, private router: Router) {
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | submitLogin(){
|
---|
| 28 | console.log("username and pass", this.username, this.password)
|
---|
| 29 | this.service.loginUser(this.username!!, this.password!!)
|
---|
| 30 | }
|
---|
| 31 | submitRegister(){
|
---|
| 32 | console.log(this.name, this.lastName,this.email,this.username,this.password,this.userType,this.index)
|
---|
| 33 | this.registerService.registerUser(this.name!!, this.lastName!!,this.email!!,this.username!!,this.password!!,this.userType!!,this.index!!)
|
---|
| 34 | }
|
---|
| 35 | showLogin(){
|
---|
| 36 | this.login = this.login == null ? true : !this.login;
|
---|
| 37 | this.register = false;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | showRegister(){
|
---|
| 41 | this.register = this.register == null ? true : !this.register;
|
---|
| 42 | this.login = false;
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | }
|
---|