Guest User

Untitled

a guest
Nov 8th, 2018
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import { Injectable } from '@angular/core';
  2. import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
  3. import {Observable} from 'rxjs';
  4. import { IRegister } from '../model/iregister';
  5.  
  6.  
  7. @Injectable({
  8. providedIn: 'root'
  9. })
  10. export class LoginHttpService {
  11.  
  12. url = "http://localhost:3000/users";
  13.  
  14.  
  15.  
  16. constructor(private http: HttpClient) { }
  17.  
  18. login(user: string,password: string): Observable<any> {
  19.  
  20. const params=new HttpParams({fromString:`username=${user}&password=${password}`});
  21. //params.set('username',user).set('password',password);
  22. return this.http.get<IRegister[]>(this.url,{params:params});
  23.  
  24. }
  25.  
  26. }
Add Comment
Please, Sign In to add comment