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

<script lang="ts" setup>
import { onBeforeMount } from 'vue';

import { useUser } from './services/user';
import { changeTheme, registerTheme } from './services/echarts';
import { useEnterprise } from './services/enterprise';
import { switchTheme } from './services/theme';

const { getUser } = useUser();
const { getEnterprise } = useEnterprise();

onBeforeMount(() => {
  getEnterprise();
  setTimeout(() => {
    registerTheme();
    // changeTheme('le-dark');
    let theme =  localStorage.getItem('le-theme');
    if(theme === 'light') {
      setTimeout(() => {
        switchTheme(theme);
      }, 3000);
    }else{
      changeTheme('le-dark');
    }
  });
  setTimeout(() => {
    getUser();
  }, 1000);
});
</script>
<style lang="postcss" scoped></style>
