coreui-free-bootstrap-admin-template icon indicating copy to clipboard operation
coreui-free-bootstrap-admin-template copied to clipboard

Routing issues in the application

Open vsirghii opened this issue 2 years ago • 0 comments

  • Operating system and version (Windows 11)
  • Browser and version (Chrome: Version 99.0.4844.84 (Official Build) (64-bit))

That's what I see in the browser nav bar: http://localhost:8080/#/base/accordion That hash tag, as I understand, is because of using createWebHashHistory router setting, Coreui has in router/index.js the following:

import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes,
  scrollBehavior() {
    // always scroll to top
    return { top: 0 }
  },
})

I can't use router's beforeEach() guard with that hash sign as it's not functioning right when I'm trying to login with AWS Cognito. Plus it doesn't look nice, I haven't see a production app with that hash sign.

If I try to replace createWebHashHistory with createWebHistory object, has sign disappears and my beforeEach() guard starts functioning as expected. But createWebHistory changes the whole admin template behavior: the sidebar menu collapses on each and every link click and each click triggers the whole app to re-render (page is reloading as if it was refreshed after each link click).

So what's the trick here, how to remove hash sign from navigational path???????

Thank you,

vsirghii avatar Apr 01 '22 07:04 vsirghii