Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- login() :void {
- if (this.loginForm.valid){
- this.userSrvc.login(this.loginForm.value).subscribe(
- res =>{
- console.log("success");
- },
- error => {
- console.log("login failed");
- }
- });
- }
- }
- constructor(private http: HttpClient) {
- this.url = AppConstants.API_ENDPOINT;
- this.headers = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' });
- }
- login(params: any): Observable<User> {
- console.log("service called");
- const body = JSON.stringify({ UserName: params.userid, Password: params.password });
- console.log("body", body);
- return this.http.post<User>(this.url + 'Login', body, { headers: this.headers });
- }
Add Comment
Please, Sign In to add comment