feat: 添加视频服务器双机热备状态

This commit is contained in:
yangsy
2026-04-10 15:11:58 +08:00
parent 86e3e1726d
commit c75338cb70
7 changed files with 111 additions and 4 deletions
+11
View File
@@ -136,6 +136,17 @@ export const unwrapResponse = <T>(resp: HttpResponse<T>) => {
return data;
};
export const unwrapNullableResponse = <T>(resp: HttpResponse<T>) => {
const [err, data, result] = resp;
if (err) throw err;
if (result) {
const { isSuccess, path, msg, errorMsg } = result;
if (!isSuccess) throw new Error(`${path ? `${path}: ` : ''}${msg || errorMsg || '请求失败'}`);
}
if (data === undefined) throw new Error('响应数据不存在');
return data;
};
// 针对没有数据的响应,直接判断是否存在错误
export const unwrapVoidResponse = (resp: HttpResponse<void>) => {
const [err, , result] = resp;