本文整理汇总了TypeScript中angular2-jwt/angular2-jwt.AuthHttp.put方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AuthHttp.put方法的具体用法?TypeScript AuthHttp.put怎么用?TypeScript AuthHttp.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2-jwt/angular2-jwt.AuthHttp
的用法示例。
在下文中一共展示了AuthHttp.put方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: saveCategory
saveCategory(category:Category) {
let headers = new Headers();
headers.append('Content-Type', 'application/json');
if (category.cat_id > 0) {
return this.http.put('/categories/' + category.cat_id + '.json', JSON.stringify(category), {headers: headers})
.map((res:Response) => res.json());
} else {
return this.http.post('/categories.json', JSON.stringify(category), {headers: headers})
.map((res:Response) => res.json());
}
}
示例2: saveArticle
saveArticle(article:Article) {
let headers = new Headers();
headers.append('Content-Type', 'application/json');
if (article.art_id > 0) {
return this.http.put('/articles/' + article.art_id + '.json', JSON.stringify(article), {headers: headers})
.map((res:Response) => res.json());
} else {
return this.http.post('/articles.json', JSON.stringify(article), {headers: headers})
.map((res:Response) => res.json());
}
}
示例3: adminUpdateEmail
adminUpdateEmail(user: User): Observable<any> {
var body = {
name : user.name,
email : user.email
};
return this._http.put('/api/admin/users/'+ user.name+'/email', JSON.stringify(body))
.map( res => {
return res.json();
})
.catch(err => {
let errMsg = err.message || 'Unkown error';
return Observable.throw(errMsg);
});
}
示例4: updateUser
updateUser(user:User): Observable<any> {
// let url = 'http://localhost:8080' + user.id + '/settings';
let url = 'http://klimaoptimierungsservice.eu-gb.mybluemix.net' + user.id + '/settings';
let body = JSON.stringify ({
settings: user.settings
});
let options = {
headers: new Headers({'Content-Type':'application/json'})
};
return this._http.put(url,body,options)
.map(res => {
if (res.status == 200) {
let result = res.json();
return {success:result.success, message:"Update Success"};
} else {
return Observable.throw('Unknown error');
}
})
.catch(err => {
let errMsg = err.message || 'Unkown error';
return Observable.throw(errMsg);
});
}
示例5: save
/**
* Update an existing event at eventURL
* @param eventURL
* @param event
* @returns {Observable<Response>}
*/
public save(eventURL:string, event:EventRequest):Observable<Response> {
return this._http.put(eventURL, JSON.stringify(event));
}