import router from './router'
import { useAppStoreWithOut } from '@common/src/store/modules/app'
import { useTitle } from '@common/src/hooks/web/useTitle'
import { useNProgress } from '@common/src/hooks/web/useNProgress'
import { usePermissionStoreWithOut } from '@common/src/store/modules/permission'
import { usePageLoading } from '@common/src/hooks/web/usePageLoading'
import { NO_REDIRECT_WHITE_LIST } from '@common/src/constants'
import { useUserStoreWithOut } from '@common/src/store/modules/user'
import { codeLogin, getAuthBtn, getMenuList } from '@common/src/api/login'
import { loginLoad } from '@common/utils'

const SYS_CODE = import.meta.env.VITE_API_SYS_CODE

const path = {
  routePath: router,
  storeMAppPath: useAppStoreWithOut,
  hookProgressPath: useNProgress,
  hookTitlePath: useTitle,
  storeMPermissionPath: usePermissionStoreWithOut,
  hookLoadingPath: usePageLoading,
  constantsPath: NO_REDIRECT_WHITE_LIST,
  storeMUserPath: useUserStoreWithOut,
  apiLoginPath: { codeLogin, getAuthBtn, getMenuList }
}

loginLoad(SYS_CODE, path)
