fix: 修复当API接口定义中没有响应数据时会意外抛出空数据异常的问题

This commit is contained in:
yangsy
2026-01-08 15:52:37 +08:00
parent c273ae21d9
commit c3692de19e
9 changed files with 27 additions and 17 deletions

View File

@@ -10,7 +10,7 @@ import {
type PageResult,
type Station,
} from '@/apis';
import { unwrapResponse } from '@/utils';
import { unwrapResponse, unwrapVoidResponse } from '@/utils';
export const pageSwitchApi = async (pageQuery: PageParams<NdmSwitchPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
@@ -90,5 +90,5 @@ export const probeSwitchApi = async (ids: string[], options?: { stationCode?: St
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSwitch/probeByIds`;
const resp = await client.post<void>(endpoint, ids, { signal });
unwrapResponse(resp);
unwrapVoidResponse(resp);
};