daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Sep 4th, 2018 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // import { map } from 'rxjs/operators'; // Fails at runtime
  2. import 'rxjs/add/operator/map'; // Works fine at runtime
  3.  
  4.   public login(username: string, password: string): Observable<any> {
  5.     console.log('Sending the login credentials to obtain a token');
  6.     const credentials = { 'email': username, 'password': password };
  7.     return this.httpService.postWithHeadersInResponse(URI_LOGIN, credentials)
  8.       .map((response: HttpResponse<any>) => {
  9.         const header = response.headers.get(this.authService.getHeaderName());
  10.         const token = this.authService.extractTokenFromHeader(header);
  11.         console.log('The token from the response header: ' + token);
  12.         this.authService.setJwtTokenToLocalStorage(token);
  13.       });
  14.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top