// 运行时配置
import type { RequestConfig } from 'umi';
import { queryCurrent, queryAccess } from '@/Project/services/user';
import { LocalService } from './Engine/Storage';
import { SysStorage } from './Frameworks/SysStorage';
// 全局初始化数据配置，用于 Layout 用户信息和权限初始化
// 更多信息见文档：https://next.umijs.org/docs/api/runtime-config#getinitialstate
export async function getInitialState(): Promise<any> {
  // const currentUser = await queryCurrent();
  // const access = await queryAccess(46);

  return { currentUser: {}, access: {}, projectId: 0 };
}

// axios配置
export const request: RequestConfig = {
  headers: { 'JWT-TOKEN': LocalService.getItem(SysStorage.token) },
  // errorConfig: {
  //   errorHandler() {},
  //   errorThrower() {},
  // },
  // requestInterceptors: [],
  // responseInterceptors: [],
};
