source: Sources/frontend/src/app/login/login.component.ts

Last change on this file was 8423429, checked in by AngelNasev <angel.nasev@…>, 17 months ago

Add backend and frontend projects

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[8423429]1import { Component } from '@angular/core';
2import {LoginService} from "../login.service";
3import {ActiveUserInterface} from "../ActiveUserInterface";
4import {Router} from "@angular/router";
5import {RegisterService} from "../register.service";
6
7@Component({
8 selector: 'app-login',
9 templateUrl: './login.component.html',
10 styleUrls: ['./login.component.css']
11})
12export 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}
Note: See TracBrowser for help on using the repository browser.