Skip to content

Instantly share code, notes, and snippets.

@SaurabhLpRocks
Last active March 5, 2018 10:44
Show Gist options
  • Select an option

  • Save SaurabhLpRocks/e828e6e5a9e8831402acbcb2b8c0c376 to your computer and use it in GitHub Desktop.

Select an option

Save SaurabhLpRocks/e828e6e5a9e8831402acbcb2b8c0c376 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { Response } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import { appApiResources } from '../../app.constants';
import { LoginResponse } from '../../theme/interfaces/login-response.interface';
import { HelperService } from '../../theme/services';
import { BaseService } from '../../theme/services/base.service';
@Injectable()
export class LoginService {
constructor(public http: BaseService, public helperService: HelperService) {
}
login(postBody: any): Observable<LoginResponse> {
// "appApiResources.login" is the constant string containing login api url
return this.http.post(appApiResources.login, body)
.map((res: LoginResponse) => {
this.processLoginResponse(res);
return res;
})
.catch((error: Response) => Observable.throw(error))
.finally(() => {
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment