<template>
  <el-config-provider :locale="appStore.locale" :size="appStore.size">
    <router-view />
  </el-config-provider>
</template>

<script setup>
import useSettingsStore from '@/store/modules/settings';
import { handleThemeStyle } from '@/utils/theme';
import useAppStore from '@/store/modules/app';
import useUserStore from '@/store/modules/user';

const appStore = useAppStore();
const userStore = useUserStore();

onMounted(() => {
  nextTick(() => {
    // 初始化主题样式
    handleThemeStyle(useSettingsStore().theme);
  });
});
watch(
  () => userStore.token,
  () => {
    if (userStore.token) {
      userStore.setTimeoutInterval();
    }
  },
  {
    immediate: true
  }
);
</script>
