We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
navigateTo
1 parent d16a590 commit 0ec6787Copy full SHA for 0ec6787
examples/advanced/use-custom-fetch-composable/plugins/customFetch.ts
@@ -1,4 +1,4 @@
1
-export default defineNuxtPlugin(() => {
+export default defineNuxtPlugin((nuxtApp) => {
2
const userAuth = useCookie('token')
3
const config = useRuntimeConfig()
4
@@ -15,7 +15,7 @@ export default defineNuxtPlugin(() => {
15
},
16
onResponseError({ response }) {
17
if (response.status === 401) {
18
- return navigateTo('/login')
+ await nuxtApp.runWithContext(() => navigateTo('/login'))
19
}
20
21
})
0 commit comments