Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import { Injectable } from '@angular/core';
  2. import { Http, Headers, RequestOptions } from '@angular/http';
  3.  
  4. @Injectable()
  5. export class UserService extends ServiceBase {
  6.  
  7. apiUrl: string;
  8. private contentHeaders = new Headers();
  9.  
  10. constructor(private http: Http) {
  11. super();
  12. this.apiUrl = appConfig.apiBaseUrl + '/users';
  13. }
  14.  
  15. login(user: User) {
  16. this.contentHeaders.append('Accept', 'application/json');
  17. this.contentHeaders.append('Content-Type', 'application/json');
  18. return this.http.post(
  19. this.apiUrl+'/sign_in',
  20. JSON.stringify({user: user}),
  21. {headers: this.contentHeaders}
  22. );
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement