1 réponse
jordane45
Messages postés
37253
Date d'inscription
mercredi 22 octobre 2003
Statut
Modérateur
Dernière intervention
17 mars 2023
4 551
18 sept. 2018 à 19:40
18 sept. 2018 à 19:40
Bonjour,
Je ne fais pas d'Angular.. donc pas sûr que je puisse te trouver la réponse...
Quoi qu'il en soit... sans voir ton code.. il sera compliqué de t'aider..... non ??!
Je ne fais pas d'Angular.. donc pas sûr que je puisse te trouver la réponse...
Quoi qu'il en soit... sans voir ton code.. il sera compliqué de t'aider..... non ??!
Modifié le 19 sept. 2018 à 09:34
import { Injectable } from '@angular/core';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { HttpHeaders } from '@angular/common/http';
import { Login } from './login';
import { Observable, of } from '../../../node_modules/rxjs';
import { ConfigService } from '../config/config.service';
import { HttpErrorHandlerService, HandleError } from '../services/http-error-handler.service';
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json; charset=utf-8'
})
};
@Injectable({
providedIn: 'root'
})
export class LoginService {
auth : Login ;
// model = new Login('paul','paul');
// private handleError: HandleError;
constructor(
private http:HttpClient,
protected configService : ConfigService,
httpErrorHandler :HttpErrorHandlerService
) {
}
login(username: string, password: string): Observable<Login>{
return this.http.post<Login>(`https://localhost:44358/api/Employee?username=${username}&password=${password}`,{username: username, password: password},httpOptions)
}
}
Mon interface Login :
export interface Login {username: string;
password: string;
}
Mon typescript :
et mon html :