import { PropsWithChildren } from "react";
import { useLaunch } from "@tarojs/taro";
import { RecoilRoot } from "recoil";
import { getGlobalConfig } from "@/apis";

import "@/styles/tailwind.basic.css";

function App({ children }: PropsWithChildren<any>) {
  useLaunch(() => {
    loadGlobalConfig();
    // 自定义header信息
    console.log("App launched.");
  });

  // 初始化全局配置
  const loadGlobalConfig = async () => {
    const res = await getGlobalConfig();
    console.log(res);
  };

  return <RecoilRoot>{children}</RecoilRoot>;
}

export default App;
