I've set up routes in Vue and added some middleware conditions before each route, but it's not functioning as expected.
Below is the content of my router/index.js
file:
const token = computed(() => useAuthStore().token);
// Main Router
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [..........
The issue I'm encountering is related to the dashboard. Whenever I reload the page while on the /dashboard/deposit
route, the route changes to /dashboard
. I suspect the problem lies within the middleware defined in router.beforeEach
.
This issue persists in another route as well.
My goal is to remain on the same route even after page refresh.