Home > Net >  How to redirect to another path in Nuxt?
How to redirect to another path in Nuxt?

Time:10-26

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?

CodePudding user response:

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.

CodePudding user response:

You can use this.$router.push('/another-page'); for internal links.

  • Related