fix
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
<script setup>
|
||||
import { PerfectScrollbar } from 'vue3-perfect-scrollbar'
|
||||
import { VNodeRenderer } from './VNodeRenderer'
|
||||
import { layoutConfig } from '@layouts'
|
||||
import {
|
||||
VerticalNavGroup,
|
||||
VerticalNavLink,
|
||||
VerticalNavSectionTitle,
|
||||
VerticalNavGroup,
|
||||
VerticalNavLink,
|
||||
VerticalNavSectionTitle,
|
||||
} from '@layouts/components'
|
||||
import { useLayoutConfigStore } from '@layouts/stores/config'
|
||||
import { injectionKeyIsVerticalNavHovered } from '@layouts/symbols'
|
||||
|
||||
import { PerfectScrollbar } from 'vue3-perfect-scrollbar'
|
||||
import { useStore } from 'vuex'
|
||||
import { VNodeRenderer } from './VNodeRenderer'
|
||||
const store = useStore();
|
||||
const router = useRouter()
|
||||
const ability = useAbility()
|
||||
const userData = useCookie('userData')
|
||||
const props = defineProps({
|
||||
tag: {
|
||||
type: null,
|
||||
@@ -51,7 +55,26 @@ Close overlay vertical nav when link is clicked
|
||||
*/
|
||||
const route = useRoute()
|
||||
|
||||
watch(() => route.name, () => {
|
||||
watch(() => route.name, async () => {
|
||||
console.log('name=====')
|
||||
|
||||
await store.dispatch('checkLogin')
|
||||
const isLoggedIn = await store.getters.getCheckLoginExpire
|
||||
console.log('check login', isLoggedIn)
|
||||
|
||||
// Add additional logic or redirection based on login status if needed
|
||||
if (isLoggedIn) {
|
||||
await store.dispatch('updateCheckToken',false)
|
||||
|
||||
// Redirect to login page or perform any other action
|
||||
useCookie('accessToken').value = null
|
||||
|
||||
localStorage.removeItem('admin_access_token');
|
||||
useCookie('userAbilityRules').value = null
|
||||
ability.update([])
|
||||
router.push({ name: 'login' })
|
||||
}
|
||||
|
||||
props.toggleIsOverlayNavActive(false)
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user