Closed DengSihan closed 3 years ago
Thanks for what a remarkable job you have done!
I wonder if I can use the default error() function of Nuxtjs to handle axios errors globally as same as what we do in middlewares like below:
error()
// ~/plugins/axios.js export default ({ $axios, error }) => { $axios.onResponseError(e => { error({ statusCode: e.response.status, message: e.response.statusText }); }); }
But it doen't work as expected.
What I want: What I get:
sorry for my careless, it's already in helpers
export default function ({ $axios, error: nuxtError }) { $axios.onError(error => { nuxtError({ statusCode: error.response.status, message: error.message, }); return Promise.resolve(false); }) }
Thanks for what a remarkable job you have done!
I wonder if I can use the default
error()
function of Nuxtjs to handle axios errors globally as same as what we do in middlewares like below:But it doen't work as expected.
What I want: What I get: