Nuxt performs routing jump in axios request interception

need:

The framework built with nuxt, because the user needs to be prompted to log in again and return to the login page after the request token expires,

But using router.push in the axios configuration file keeps reporting errors

solve:

There is a redirect attribute in the context context , which can redirect routes or URLs

redirect('https://vuejs.org')

redirect("/")

Guess you like

Origin blog.csdn.net/YZ_ZZZ24/article/details/122237510