Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. export class ApiService {
  2.  
  3. constructor(public http: Http) { }
  4.  
  5. put(controller: string, method: string, data: Object) {
  6.  
  7. return this.http.put("http://127.0.0.1:8000",
  8. JSON.stringify(data), {
  9. })
  10.  
  11. .map(res => res.json())
  12.  
  13. .catch(err => {
  14. return Observable.throw(err.json());
  15. });
  16.  
  17. }
  18.  
  19. }
  20.  
  21. export class AccountService {
  22.  
  23. api: ApiService;
  24.  
  25. constructor() {
  26. this.api = new ApiService();
  27. }
  28.  
  29. login(username: string, password: string) {
  30.  
  31. return this.api.put("accounts", "login", { username: username, password: password});
  32.  
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement