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

Loading…
Cancel
Save