fix: 兼容后端返回不完整的设备类型

This commit is contained in:
yangsy
2025-12-15 12:46:02 +08:00
parent 9ca5630c87
commit 91a2fcb743

View File

@@ -1,4 +1,4 @@
import { ndmClient, userClient, type StationDevices } from '@/apis';
import { initStationDevices, ndmClient, userClient, type StationDevices } from '@/apis';
export const getAllDevicesApi = async (options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
@@ -9,5 +9,9 @@ export const getAllDevicesApi = async (options?: { stationCode?: string; signal?
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
// 由于各线路后端版本不一致,接口返回的设备类型可能不够完整,需要做一次合并
return {
...initStationDevices(),
...data,
};
};