fix: while last opened tab is loaded instead of rerouting just update the route with hash
This commit is contained in:
parent
9e156efe9b
commit
2f58da93a6
@ -46,7 +46,6 @@ export function useActiveTabManager(tabs, storageKey) {
|
||||
|
||||
let lastVisitedTab = getActiveTabFromLocalStorage()
|
||||
if (lastVisitedTab) {
|
||||
setActiveTabInUrl(lastVisitedTab)
|
||||
return getTabIndex(lastVisitedTab)
|
||||
}
|
||||
|
||||
|
||||
@ -145,10 +145,16 @@ router.beforeEach(async (to, from, next) => {
|
||||
if (to.name === 'Home' && isLoggedIn) {
|
||||
next({ name: 'Leads' })
|
||||
} else if (!isLoggedIn) {
|
||||
window.location.href = "/login?redirect-to=/crm";
|
||||
window.location.href = '/login?redirect-to=/crm'
|
||||
} else if (to.matched.length === 0) {
|
||||
next({ name: 'Invalid Page' })
|
||||
} else {
|
||||
if (['Deal', 'Lead'].includes(to.name) && !to.hash) {
|
||||
let storageKey = to.name === 'Deal' ? 'lastDealTab' : 'lastLeadTab'
|
||||
const activeTab = localStorage.getItem(storageKey) || 'activity'
|
||||
const hash = '#' + activeTab
|
||||
next({ ...to, hash })
|
||||
}
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user