Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Injectable } from '@angular/core';
- import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
- import {Observable} from 'rxjs';
- import { IRegister } from '../model/iregister';
- @Injectable({
- providedIn: 'root'
- })
- export class LoginHttpService {
- url = "http://localhost:3000/users";
- constructor(private http: HttpClient) { }
- login(user: string,password: string): Observable<any> {
- const params=new HttpParams({fromString:`username=${user}&password=${password}`});
- //params.set('username',user).set('password',password);
- return this.http.get<IRegister[]>(this.url,{params:params});
- }
- }
Add Comment
Please, Sign In to add comment