0

I have a NuxtJs (vue) application in Netlify, when I redirect to other pages, It will to concat the last page and the next.

For example:

https://page-example/register

I'm in this page, then I redirect to the next page with

this.$router.push("confirmationsend");

In local I get this url :

https://localhost:3001/confirmationsend

but in Netlify I get this url:

https://page-example/register/confirmationsend

And NuxtJs can't resolve this routing.

0

1 Answer 1

1

You could either be pushing a path, like this

this.$router.push('/confirmationsend')
// equivalent to this.$router.push({ path: '/confirmationsend' })

or use the name property (you can find the name in either your router file if you got one or in the Vue devtools)

$router.push({ name: 'confirmationsend' })

As shown in the Vue router documentation.
Mixing both (name + path) is usually not a good idea since a push without a / is by default meaning "append it to my current route" in the context of a History push.

Hence why I do recommend any of the snippets above to be more explicit regarding what you're trying to tell to the Vue router/various hosting platforms.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.