2

Im currently, making a form, where I have a button, "Save and add another" , what I do, I validate the data and if saving is a success I'm trying to redirect the user to the same page but its not working(example: from this page http://localhost:8080/#/add_new_entity to this page http://localhost:8080/#/add_new_entity).

So far i've tried this:

this.$router.push('/add-new-entity')

i get this error:

NavigationDuplicated {_name: "NavigationDuplicated", name: "NavigationDuplicated", message: "Navigating to current location ("/add_new_entity") is not allowed", stack: "Error↵ at new NavigationDuplicated (http://loca…voker (http://localhost:8080/js/app.js:135303:14)"}

And i know i could just refresh, but i have set in my router/index.js this: router.replace({ path: '/dashboard', redirect: '/dashboard' }) so every time the page is refreshed it automaticaly redirects to /dashboard.

Any solutions out there?

EDIT: I still havent found a solution for that. Yes this catches the error this.$router.push("/add-new-entry").catch(err => {}) so I dont get the error message and can handle it, but I'm still not able to redirect to the same page.

1 Answers1

0

Just do this.$router.push("/add-new-entry").catch(err => {})

FPcond
  • 581
  • 2
  • 7
  • 21