<script setup lang="ts">
import { onLaunch } from '@dcloudio/uni-app'
import { useAuthStore } from './store/auth'
import { configTheme } from './components/theme/ThemeDefine';
import { RequestApiConfig } from '@imengyu/imengyu-utils';
import ApiCofig from './common/config/ApiCofig';
import { isDev } from './common/config/AppCofig';

const authStore = useAuthStore();

onLaunch(() => {
  console.log('App Launch');

  uni.loadFontFace({
    global: true,
    family: "SongtiSCBlack",
    source: 'url("https://mncdn.wenlvti.net/assets/fonts/STSongti-SC-Black.woff")',
  });
  uni.loadFontFace({
    global: true,
    family: "HUNdin1451",
    source: 'url("https://mncdn.wenlvti.net/app_static/minnan/fonts/HUN-din1451.woff")',
  });

  authStore.loadLoginState();
})

RequestApiConfig.setConfig({
  ...RequestApiConfig.getConfig(),
  BaseUrl: isDev ? ApiCofig.server.Dev : ApiCofig.server.Prod,
})

configTheme(false, (theme, darkTheme) => {
  theme.colorConfigs.default.primary = '#d9492e';
  theme.colorConfigs.pressed.primary = '#882d1d';
  theme.colorConfigs.background.primary = '#ffcfc6';
  theme.colorConfigs.background.page = '#f6f2e7';
  return [theme, darkTheme];
});
</script>

<style lang="scss">
@use "@/common/scss/fonts.scss" as *;
@use "@/common/scss/common.scss" as *;
@use "@/common/scss/global/base.scss" as *;
@use "@/components/index.scss" as *;
</style>

