/** 上游 NewAPI 服务的根地址 */ const BASE_URL = "https://api.qflink.xyz"; /** * 向上游 NewAPI 发起请求 * * @param path 相对路径,如 "/api/user/register",会自动拼接到 BASE_URL 后面 * @param options 透传给 $fetch 的所有选项(method、body、headers 等) * @returns Promise,T 是上游返回的数据类型 * * @example * const result = await newApiFetch("/api/user/register", { * method: "POST", * body: { username: "xxx" } * }) */ export const newApiFetch = ( path: string, options?: Parameters[1] ): Promise => { return $fetch(path, { baseURL: BASE_URL, ...options }) as Promise; };