Guest User

Untitled

a guest
Jan 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. postData(credentials,type){
  2. return new Promise((resolve, reject) =>{
  3. let headers = new HttpHeaders();
  4. this.http.post(apiUrl+type, JSON.stringify(credentials), {headers: headers}).
  5. subscribe(res =>{
  6. resolve(res.json());
  7. }, (err) =>{
  8. reject(err);
  9. });
  10. });
  11. }
  12.  
  13. public postData(credentials: Object, type: string): Promise<any> {
  14. return new Promise((resolve, reject) => {
  15. this.http.post(apiUrl + type, credentials).subscribe(
  16. response => {
  17. resolve(response);
  18. },
  19. exception => {
  20. reject(exception);
  21. }
  22. );
  23. });
  24. }
Add Comment
Please, Sign In to add comment