I am a beginner with vue
and I recently created a small vue app on codesandbox:
https://codesandbox.io/s/vue-template-fjd4i
However, I am facing issues with routing. Here is how to reproduce the problem:
- Click on
Login
and enter any credentials - You should now be on the
Board page
- Click on the
Statistics
page - Instead of the
Statistics
page, I am redirected to theSignup
page. I am unsure why this is happening.
To update the navbar after logging in, I am using EventBus
in event-bus.js
:
// EventBus.js
import Vue from "vue";
export default new Vue();
When I am logged in (on the Board
page) and click on Statistics
, I noticed that the router's beforeEach
function in router/index.js
displays incorrect information:
router.beforeEach((to, from, next) => {
console.log("///////");
console.log(from);
console.log(to);
console.log(next);
console.log("///////");
Instead of receiving the Statistics
route in the to
variable, I am getting the Signup
route. Can someone please assist me with this issue?