`navigateTo` has no effect when a plugin is declared
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v16.15.1
- Nuxt Version:
3.0.0-rc.8
- Package Manager:
npm@8.11.0
- Builder:
vite
- User Config:
runtimeConfig
,css
,vite
,typescript
,modules
,unocss
- Runtime Modules:
@unocss/nuxt@^0.44.7
,@vueuse/nuxt@9.1.1
- Build Modules:
-
Reproduction
https://codesandbox.io/s/nuxt-3-navigateto-with-usefetch-15ihel
Describe the bug
To intercept every 401 error I receive from my API, I created a wrapper method of useFetch
:
export function useApi(request) {
return useFetch(request, {
async onResponseError(ctx) {
if (ctx.response.status === 401) {
await navigateTo("/login", { replace: true, redirectCode: 401 });
}
}
});
}
But somehow, it only works if I don’t have any plugins declared.
If you comment every line of this file, the redirection works well, but as long as the defineNuxtPlugin
function is called, the redirection does not work. Why ?
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
php - Netbeans 7 - Won't navigate to declaration with multiple ...
referenced in my code and I select (for example) a function, I want it to open up the PHP code module that contains...
Read more >Xrm.Navigation.navigateTo - gotchas, tricks and limitations
openDialog() are not working for the 9.0 on-premise, it gives me an error with the reason that DialogOptions is not a constructor.
Read more >Navigate to method definition in VSCode
There is an option for it, you can right-click on the method name and then 'Go to Definition'. This also works for Classes...
Read more >Navigate to a destination - Android Developers
This plugin generates simple object and builder classes that enable type-safe navigation between destinations.
Read more >Plugin Development - Girder - Read the Docs
A plugin is self-contained python package with an optional “web_client” directory ... Girder plugins including web extensions do not support this feature.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you! I was trying the same lead ! It works!
Happy hearing this! Let’s track improvements from linked issues.