使用Nuxt拦截阿波罗模块上的网络错误

vue.js Vue.js

飞云

2020-04-07

我正在使用nuxtwith apollo-module,我需要拦截可能的网络错误(更具体地讲是401/403),因此我可以显示一些错误模式并注销用户。在文档中,我看到nuxt.config.js您可以执行以下操作:

  apollo: {
    tokenName: 'Authorization',
    authenticationType: 'Bearer',
    errorHandler(error) { do something }
  }
...

但是在该配置文件中,我无法访问所需的应用程序功能(例如,错误模式或路由器)。有什么办法可以存档吗?

第4128篇《使用Nuxt拦截阿波罗模块上的网络错误》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

0个回答

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android