BackEnd #3

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

View File

@ -4,30 +4,24 @@ import { Observable, throwError } from 'rxjs';
import { catchError, retry } from 'rxjs/operators';
import { User } from './user';
import { Discoteca } from './discoteca';
import { UserLogin } from './user-login';
@Injectable({
providedIn: 'root'
})
export class ApiService {
url = '';
constructor(private http: HttpClient) {
}
validateUser(loginUser: string, loginPassword: string): boolean{
return (loginUser=='');
validateUser(user: UserLogin): Observable<User>{
return this.http.post<User>(this.url, user);
}
getUser (loginUser: string): void{
}
postNewUser(user: User): void{
}
postNewDiscoteca(discoteca: Discoteca): void{
}
}

View File

@ -1,30 +1,26 @@
import { Injectable } from '@angular/core';
import { ApiService } from './api.service';
import { User } from './user';
import { UserLogin } from './user-login'
@Injectable({
providedIn: 'root'
})
export class LoginService {
private userId: number;
private sessionType: number;
private loginUser: string;
private loginPassword: string;
user: User;
constructor(private apiService: ApiService) {
}
validateUser(loginUser: string, loginPassword: string): boolean{
return (loginUser=='');
validateUser(login: string, password: string): void{
let user : UserLogin = {
loginUser: login,
loginPassword: password,
}
this.apiService.validateUser(user)
.subscribe((data: User) => this.user = {...data});
}
getUser (loginUser: string): void{
}
postNewUser(user: User): void{
}
}

4
src/app/user-login.ts Normal file
View File

@ -0,0 +1,4 @@
export interface UserLogin {
loginUser: string;
loginPassword: string;
}