feat: 新增流媒体/信令服务状态卡片
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
export * from './ndm-security-box';
|
||||
export * from './ndm-service-available';
|
||||
export * from './ndm-switch';
|
||||
|
||||
25
src/apis/request/biz/other/ndm-service-available.ts
Normal file
25
src/apis/request/biz/other/ndm-service-available.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { ndmClient, userClient, type MediaServerStatus, type Station } from '@/apis';
|
||||
|
||||
export const isMediaServerAliveApi = async (options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmServiceAvailable/mediaServer/isAlive`;
|
||||
const resp = await client.get<MediaServerStatus[]>(endpoint, { signal });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const isSipServerAliveApi = async (options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmServiceAvailable/sipServer/isAlive`;
|
||||
const resp = await client.get<boolean>(endpoint, { signal });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (data === null) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
Reference in New Issue
Block a user