重构(vimp): 重命名VIMP API文件并更新调用处

将原有的catalog.channel和catalog.all-device API文件重命名为带client前缀的新文件,新增对应API实现模块,修复all-device接口函数名的拼写错误,并更新use-channels-query组合式函数中的API调用逻辑
This commit is contained in:
yangsy
2026-06-16 10:32:32 +08:00
parent 2953c7a758
commit 9f127d2927
4 changed files with 7 additions and 7 deletions
@@ -1,7 +1,7 @@
import { unwrapVimpResponse, vimpClient } from '../client';
import { normalizeVimpSite, type VimpRawSite } from '../model';
export const catalogAllDeviceApi = async (options?: { signal?: AbortSignal }) => {
export const clientCatalogAllDeviceApi = async (options?: { signal?: AbortSignal }) => {
const { signal } = options ?? {};
const client = vimpClient;
const endpoint = `/client/catalog/allDevice`;
@@ -1,7 +1,7 @@
import { unwrapVimpResponse, vimpClient } from '../client';
import type { VimpChannel } from '../model';
export const catalogChannelApi = async (code: string, options?: { signal?: AbortSignal }) => {
export const clientCatalogChannelApi = async (code: string, options?: { signal?: AbortSignal }) => {
const { signal } = options ?? {};
const client = vimpClient;
const endpoint = `/client/catalog/channel`;
+2 -2
View File
@@ -1,2 +1,2 @@
export * from './catalog.channel';
export * from './catalog.all-device';
export * from './client.catalog.channel';
export * from './client.catalog.all-device';
@@ -4,7 +4,7 @@ import type { AxiosRequestConfig } from 'axios';
import axios from 'axios';
import { compileCodeAreas, type CodeArea, type CodeLines, type CodeSites } from '../../types';
import { useCameraStore, useAlarmStore } from '../../stores';
import { catalogAllDeviceApi, catalogChannelApi, type VimpChannel, type VimpSite } from '../../apis';
import { cientCatalogAllDeviceApi, clientCatalogChannelApi, type VimpChannel, type VimpSite } from '../../apis';
import { VIMP_CHANNELS_QUERY_KEY } from '../../constants';
const config: AxiosRequestConfig = {
@@ -69,7 +69,7 @@ export const useChannelsQuery = () => {
codeTrainAreas,
});
const sitesFromApi = await catalogAllDeviceApi({ signal });
const sitesFromApi = await cientCatalogAllDeviceApi({ signal });
// 从 /allDevice 接口获取的站点信息并不保证真实性和完整性,
// 例如有一个站点的编码是 010699 开头,但是其下的通道是 010199 和 010599 开头,
@@ -82,7 +82,7 @@ export const useChannelsQuery = () => {
const siteCodeToAlarmsMap = new Map<string, VimpChannel[]>();
for (const siteFromApi of sitesFromApi ?? []) {
const channels = await catalogChannelApi(siteFromApi.code, { signal });
const channels = await clientCatalogChannelApi(siteFromApi.code, { signal });
if (!channels) continue;
channels.forEach((channel) => {