本文整理汇总了TypeScript中app/http.MyHttp类的典型用法代码示例。如果您正苦于以下问题:TypeScript MyHttp类的具体用法?TypeScript MyHttp怎么用?TypeScript MyHttp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MyHttp类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: login
login(email, password):Observable<Response> {
return this.http.post('/api/login', JSON.stringify({
email: email,
password: password,
})).do(resp => {
localStorage.setItem('jwt', resp.headers.get('x-auth-token'));
});
}
示例2: list
list(userId:string, params:{maxId:number, count:number}):Observable<Micropost[]> {
return this.http.get(url(userId), {search: objToSearchParams(params)})
.map(res => res.json())
;
}
示例3: unfollow
unfollow(followerId:string):Observable<Response> {
return this.http.delete(`${url}/to/${followerId}`);
}
示例4: follow
follow(followerId:string):Observable<Response> {
return this.http.post(`${url}/to/${followerId}`, '');
}
示例5: showFeed
showFeed():Observable<Micropost[]> {
return this.http.get(`${url}`)
.map(resp => resp.json())
;
}
示例6: create
create(content:string):Observable<Response> {
const body = JSON.stringify({content: content});
return this.http.post(url, body);
}
示例7: delete
delete(id:Number):Observable<Response> {
return this.http.delete(`${url}/${id}`);
}
示例8: listFollowers
listFollowers(userId:string, params:{maxId:number, count:number}):Observable<User[]> {
return this.http.get(`${url}/${userId}/followers`, {search: objToSearchParams(params)})
.map(res => res.json())
;
}
示例9: updateMe
updateMe(userParam:UserParams):Observable<Response> {
return this.http.patch(`${url}/me`, JSON.stringify(userParam))
.do(resp => {
localStorage.setItem('jwt', resp.headers.get('x-auth-token'));
});
}
示例10: create
create(params:UserParams):Observable<Response> {
return this.http.post(url, JSON.stringify(params));
}