1
如果用戶從我的API中收到403,我想將用戶重定向到/login
。以下是我在我的/app/routes/application.js
:在Ember.js中處理403
import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth-auth0/mixins/application-route-mixin';
export default Ember.Route.extend(ApplicationRouteMixin, {
actions: {
error(error, transition) {
if (error.status === '403') {
this.replaceWith('login');
} else {
return true;
}
}
}
});
但是,這似乎並沒有與Ember的數據很好地工作,當返回403,引發異常,而不是由路由器處理的,任何提示?
你能告訴我一個這樣的例子嗎?我不確定我明白。 –
當然,只是更新。這應該能處理你之後的事情。 – acorncom