I added to my nuxt project apollo. I build an login which sets the jwt when the login is successful, but when it expried I get an nuxt error. I try to catch the nuxt error with an apollo error handler, but the handler do not work. How am I able to catch the error, to set a new token?
nuxt.config.js
....
apollo: {
authenticationType: 'Bearer',
clientConfigs: {
default: '~/graphql/config/config.ts'
},
errorHandler: '~/plugins/apollo-error-handler.ts',
tokenName: 'apollo-token'
}
...
My error handler looks like:
import { Context } from '@nuxt/types'
export default ({ redirect, app, $apolloHelpers, ...rest }: Context) => {
console.log(1, rest)
}