javascriptvue.jsnuxt.jsvue-router

How to redirect to another path in Nuxt?


Hello I want to redirect to an internal path.

Example

https://mylink.com/some-page.html

and my fetch link

https://mylink.com/another-page.html

I use router.replace but it adds the last link inside of the first one. How to fix this to replace the first link by the second?

I use

window.location

Is it possible to do it with another solution thanks to vue router?

The idea is

params {'another-page'}

but the API returns the whole URL: https://mylink.com/another-page.html, not just the path.

How to achieve this?


Solution

  • You should probably take the received URL and cut the last part of it to have only the path. Then you could use the Vue router to move to the according page inside of your Nuxt app.