

import type { App } from 'vue';
import('ant-design-vue/dist/antd.less');
import 'virtual:svg-icons-register';
import { registerGlobalComponent } from './register-global-component';
import { setupRouter } from './router';
import { setupStore } from './store';
import { http } from '/nerv-lib/util/http';

export * from '/nerv-lib/component';
export * from '/nerv-lib/paas/component';
export * from '/nerv-lib/paas/view';
export * from '/nerv-lib/util';
export * from '/nerv-lib/use';
export * from '/nerv-lib/paas/store/modules/authorization-service';

// if (import.meta.env.DEV) {
// }
import './theme/theme.less';
import { appConfigStore } from '/nerv-lib/paas/store/modules/app-config';

export function paasInit(config: { app: App; apiModule: object; appConfig: any; modules?: any }) {
  const { app, apiModule, appConfig, modules } = config;
  http.apiModule = apiModule;
  http.projectType = appConfig.projectType;
  console.log(appConfig.timeout);
  http.setTimeout(appConfig.timeout);
  http.setHeaders(appConfig.headers);

  setupStore(app);
  const configStore = appConfigStore();
  configStore.setConfig(appConfig);
  registerGlobalComponent(app);
  setupRouter(app, modules);
}
