import HttpService from "./request";

export const handle = (p: { [index: string]: any}) => {
  const httpService = new HttpService()
  // @ts-ignore
  return httpService[p.method.toLowerCase()](p)
}

// @ts-ignore
const files = import.meta.glob("/src/api/modules/**/*.ts")
const apiModule: any = {}

for (const [key, value] of Object.entries(files)) {
  // @ts-ignore
  value().then(res => {
    Object.assign(apiModule, res)
  })
}
export default apiModule
