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

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { useSimApi } from '@simcu/simapi/pinia'

const router = useRouter()
const api = useSimApi()

api.setBusinessCallback(401, () => {
  api.logout(null)
  router.replace('/login')
})

api.setBusinessCallback('common', (data: any) => {
  ElMessage.error(data?.message || '请求失败')
})
</script>
