export type GetApiApiV1DashboardMainArgs = {type: string}; export type GetApiApiV1DashboardMainOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * 页面通用接口 : 视图 * * GET /api/v1/dashboard/main */ export const getApiApiV1DashboardMain = async (args: GetApiApiV1DashboardMainArgs, options: GetApiApiV1DashboardMainOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.type != null) query.append("type", String(args.type)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/dashboard/main${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };