Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- login(username: string, password: string): Observable<boolean> {
- const url = this.getUrl('/v1/users/login');
- const headers = {
- headers: new HttpHeaders({'Content-Type': 'application/json', 'transactionId': uuid.v4()})
- };
- const body = { username, password };
- return new Observable<boolean>( observer => {
- this.http.post<User>(url, body, headers).subscribe(
- (user: User) => {
- console.log('login: Success: ', user);
- observer.next(true);
- },
- (err: HttpErrorResponse) => {
- console.log('login: Error: ', err);
- observer.next(false);
- }
- );
- });
- }
Add Comment
Please, Sign In to add comment