BackEnd #3

Merged
onsaliyo merged 11 commits from BackEnd into master 2021-03-31 13:01:27 +02:00
3 changed files with 12 additions and 9 deletions
Showing only changes of commit 36426bc643 - Show all commits

View File

@ -21,9 +21,11 @@ export class ApiService {
validateUser(user: UserLogin): Observable<User>{
return this.http.post<User>("http://localhost:3307/api/consultas/users", user);
return this.http.post<User>("http://localhost:3307/api/consultas/users", user)
}
}

View File

@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { VirtualTimeScheduler } from 'rxjs';
import { ApiService } from './api.service';
import { User } from './user';
import { UserLogin } from './user-login';
@ -21,7 +22,7 @@ export class LoginService {
};
}
validateUser(login: string, password: string): User {
validateUser(login: string, password: string): void{
let userlogin: UserLogin = {
loginUser: login,
@ -29,12 +30,12 @@ export class LoginService {
}
this.apiService.validateUser(userlogin)
.subscribe(user => this.user = user)
return this.user;
.subscribe(user => {
this.user = user;
console.log(this.user);
})
}
}

View File

@ -20,12 +20,12 @@ export class LoginPage implements OnInit {
this.user = this.loginService.user;
}
async login() {
login() {
this.username = (<HTMLInputElement>document.getElementById("username")).value;
this.password = (<HTMLInputElement>document.getElementById("password")).value;
this.user = await this.loginService.validateUser(this.username, this.password);
console.log(this.user.username);
this.loginService.validateUser(this.username, this.password)
}