Skip to content

Commit

Permalink
fix: 修复了URLBase不解析的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Zecyel committed Jul 3, 2024
1 parent a1125c9 commit 830a257
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion util/callApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import Ajv, { type Schema } from 'ajv'
const ajv = new Ajv()

export async function callApi(schema: any, payload: any, param: any = {}, config: any = {}) {
const runtimeConfig = useRuntimeConfig()
const AUTH = runtimeConfig.public.authBase
const TREEHOLE = runtimeConfig.public.treeHoleBase
const URL_MAPPER = { AUTH, TREEHOLE }

const NoResponse = {
type: undefined,
Expand All @@ -27,7 +31,7 @@ export async function callApi(schema: any, payload: any, param: any = {}, config
config.headers["Authorization"] = `Bearer ${userStore.access_token}`
}

let path = `/${schema.base}${schema.path}`
let path = URL_MAPPER[schema.base] + schema.path

for (let cur_param in param) {
console.log(cur_param, param[cur_param])
Expand Down

0 comments on commit 830a257

Please sign in to comment.