2
は別途catchブロック内にそれらのそれぞれを処理することなく、一般的な方法で、サーバからの送信403個の応答を処理する方法はありますか? `アウレリア(活字体)での一般的な方法で403エラーを処理
//現在のコード
searchCustomer(customerName: string): any {
if (customerName != "") {
let url = 'clinics/customers/lookup/name/' + customerName;
let headers = new Headers();
headers.append('accept', 'application/vnd.vetserve.customerlookup.v1.hal+json');
return this.http.fetch(url, { method: 'GET', headers: headers })
.then(response => response.json())
.catch(error => {
if(error.status==403){
this._messageService.showMessage('No permission', MessageService.type.error, error);
}
console.log(error);
}
);
}
}`
インターセプタの設定を見てください - http://aurelia.io/hub.html#/doc/article/aurelia/fetch-client/latest/http-services/3 – Tom
実際には私に必要なのはメソッド呼び出し自動的に403が来るとき – Heshan
はい - インターセプタを使用してヘッダーのステータスを確認し、必要な方法を呼び出すことができます。 – Tom