This commit is contained in:
nasir@endelospay.com
2024-06-06 22:48:39 +05:00
parent 31893255d2
commit 970a063bec
2 changed files with 62 additions and 7 deletions

View File

@@ -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)
})