Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cdubant's avatar

Vue router + Spark : Redirects to homepage when router.go

Hi,

I've implemented Vue Router to Spark and I have a functioning SPA, I just have one issue that I don't manage to solve myself.

What happens is when I login to my Spark application :

  1. Login to the app (the URL is already the previous page I was on "/projects")
  2. Then it's overwritten by "/home"
  3. Then "/dashboard" (as the * redirect states in my router)
  4. Now the SPA page appears (on the dashboard page)

Now if I change the "active" project in my SPA (which drives the reports displayed and every other info, everything is linked to a "project") doing so (let's assume I'm on the "/reports" page) :

this.$router.go({
    path: this.$router.path,
    query: {
        t: + new Date()
    }
});

Then the url is still "/reports" and the page reloads but the page displayed is the vanilla homepage of Spark as in the "/" URL but the URL is still "/reports".

I have to click the "Login" button and I see the same sequence as "/reports" turns to "/home" and then turns to "/dashboard" ==> F**$ing broken UX for a Webapp !

This is the content of my bootstrap.js file

const router = new VueRouter({
    mode: 'history',
    base: __dirname,
    routes: [
        { path: '/dashboard', component: Dashboard },
        { path: '/requirements', component: Requirements },
        { path: '/reports', component: Reports },
        { path: '/projects', component: Projects },
        { path: '*', redirect: '/dashboard' }
    ]
});

My guess is maybe I have to deactivate some redirect to "/home" but I'm ont quite sure this is the right approach (as in modify the UserController login flow).

Thanks in advance for your insights.

0 likes
0 replies

Please or to participate in this conversation.