感谢您为 AOR 所做的出色工作,这对我来说是一个很好的灵感来源,尤其是在如何实现一个适当的 redux 存储方面。
我的问题:如果我提出错误请求(代码 400),AOR 将我从应用程序中注销。我怎样才能防止这种情况,而是向我的用户显示通知?
感谢您为 AOR 所做的出色工作,这对我来说是一个很好的灵感来源,尤其是在如何实现一个适当的 redux 存储方面。
我的问题:如果我提出错误请求(代码 400),AOR 将我从应用程序中注销。我怎样才能防止这种情况,而是向我的用户显示通知?
您可以按照说明来实现它:
import { AUTH_ERROR } from 'admin-on-rest';
export default (type, params) => {
if (type === AUTH_ERROR) {
// As I noticed, this code is executed for any error, not only for auth-one.
// So process the error as you wish (show message), don't log out.
}
// Then resolve the promise.
return Promise.resolve();
};