Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // import { map } from 'rxjs/operators'; // Fails at runtime
- import 'rxjs/add/operator/map'; // Works fine at runtime
- public login(username: string, password: string): Observable<any> {
- console.log('Sending the login credentials to obtain a token');
- const credentials = { 'email': username, 'password': password };
- return this.httpService.postWithHeadersInResponse(URI_LOGIN, credentials)
- .map((response: HttpResponse<any>) => {
- const header = response.headers.get(this.authService.getHeaderName());
- const token = this.authService.extractTokenFromHeader(header);
- console.log('The token from the response header: ' + token);
- this.authService.setJwtTokenToLocalStorage(token);
- });
- }
Add Comment
Please, Sign In to add comment