question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`navigateTo` has no effect when a plugin is declared

See original GitHub issue

Environment


  • 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:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Balochecommented, Sep 5, 2022

Thank you! I was trying the same lead ! It works!

0reactions
pi0commented, Sep 5, 2022

Happy hearing this! Let’s track improvements from linked issues.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found