Fix login service HTTP request type

pull/4/head
Alix JEUDI--LEMOINE 5 months ago
parent 3c3a87c4cf
commit 83423751aa

@ -1,4 +1,4 @@
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from '../../environments/environment';
@ -11,13 +11,11 @@ export class LoginService {
constructor(private http: HttpClient) {}
login(username: string, password: string): any {
const headers= new HttpHeaders({
'Content-Type':'application/x-www-form-urlencoded'
})
return this.http.post(this.apiUrl + '/login', {
username: username,
password: password,
}, {headers}).subscribe();
login(username: string, password: string): Observable<any> {
const payload = new HttpParams()
.set('username', username)
.set('password', password);
return this.http.post(this.apiUrl + '/login', payload);
}
}

Loading…
Cancel
Save