apply (username:string, password:string, interest:string): Promise<string>{ return this.http.post('apply', {username:username, password:password, interest:interest}) .toPromise() .then(response => response.json() as any) .catch(this.handleError) }
private post(hero: Hero): Promise<Hero> { let headers = new Headers({ 'Content-Type' : 'application/json' }); return this.http.post(this.heroesUrl, JSON.stringify(hero), {headers: headers}) .toPromise() .then(res => res.json().data) .catch(this.handleError); }
create(table, newData) { this.http.post(this.url + table, newData).subscribe( data => { console.log(data); this.getAll(table); }); }
public save() { let headers = new Headers({ 'Content-Type': 'application/json' }); let options = new RequestOptions({ headers: headers }); this.http.post("http://localhost:3000/api/save", JSON.stringify(this.person), options) .map(result => result.json()) .subscribe(results => { this.location.back(); }, error => { console.error(error); }); }
post(path: string, body): Observable<any> { return this.http .post(`${this.api_url}${path}`, JSON.stringify(body), { headers: this.headers }) .map(this.checkForError) .catch(err => Observable.throw(err)) .map(this.getJson); }
createScenario(scenario: ScenarioModel): Observable<ScenarioModel> { return this.http.post(this.baseUrl+'/add', scenario) .pipe( map( (scenario) => { return scenario.json() as ScenarioModel; }, (error) => { return error; } ) ); }
public save() { let headers = new Headers({ 'Content-Type': 'application/json' }); let options = new RequestOptions({ headers: headers }); this.http.post("http://localhost:3000/api/save", JSON.stringify(this.person), options) .map(result => result.json()) .subscribe(results => { this.location.back(); }, error => { console.error(error); }); }
addSongToMyList (id:string, songId:string): Promise<void>{ return this.http.post('addSongToMyList', {id:id, songId:songId}) .toPromise() .then(response => response.json() as any) .catch(this.handleError) }
token(id : string, filename: string): Promise<object>{ return this.http.post('token', {id : id, filename:filename}) .toPromise() .then(response => response.json() as any) .catch(this.handleError) }
login (username:string, password:string): Promise<string>{ return this.http.post('login', {username:username, password:password}) .toPromise() .then(response => response.json() as any) .catch(this.handleError) }
replyFriendRequest(requestId: string, status: number): Promise<void>{ return this.http.post('replyFriendRequest', {requestId:requestId, status:status}) .toPromise() .then(response => response.json() as any) .catch(this.handleError) }
addShare (id:string, friendName:string, songId:string): Promise<void>{ return this.http.post('addShare', {id:id, friendName:friendName, songId: songId}) .toPromise() .then(response => response.json() as any) .catch(this.handleError) }
createSong(userID : string, name: string, url : string): Promise<void>{ return this.http.post('createSong', {userID:userID, name:name, url:url}) .toPromise() .then(response => response.json() as any) .catch(this.handleError) }
addFriend (id:string, friendName:string): Promise<void>{ return this.http.post('addFriend', {id:id, friendName:friendName}) .toPromise() .then(response => response.json() as any) .catch(this.handleError) }
replyShareRequest(requestId: string, status: number): Promise<void>{ return this.http.post('replyShareRequest', {requestId:requestId, status:status}) .toPromise() .then(response => response.json() as any) .catch(this.handleError) }