Aug 25, 2022
0
Level 1
this.$router.push() inside common service file
Hey,
I have created a common service file. Where I have a custom function which returns this.$router.push(route) but that file is imported to another file. I am able to access all functions except redirect it through the error on push().
So, let me know how I can make a common function for redirecting to a particular route by giving in parameters and using all pages.
import router from '../routes.js';
redirect(route){
return this.$router.push(route)
}
Please or to participate in this conversation.