<template>
  <router-view />
</template>

<script lang="ts" setup>
import { useRouter } from 'vue-router'
import { dialog } from '@/utils/vant'
import { logout } from '@/business/common'
import eventBus from '@/services/bus'

const router = useRouter()

// 接收用户登出通知
eventBus.$on('LogoutNotify', (msg) => {
  logout(() => {
    if (msg) {
      dialog(msg as string)
    }
    router.replace({ name: 'login' })
  })
})
</script>