fix: queries continue running after page unmounted

This commit is contained in:
yangsy
2025-08-25 23:32:25 +08:00
parent 59a14cb9e1
commit 3cfb829608
20 changed files with 98 additions and 112 deletions

View File

@@ -2,9 +2,9 @@ import { ndmClient } from '@/apis/client';
import type { PageParams, NdmNvrPageQuery, PageResult, NdmNvrResultVO, NdmNvrUpdateVO, NdmNvrVO, ClientChannel, NdmRecordCheck } from '@/apis/models';
import dayjs from 'dayjs';
export const postNdmNvrPage = async (stationCode: string, pageQuery: PageParams<NdmNvrPageQuery>) => {
export const postNdmNvrPage = async (stationCode: string, pageQuery: PageParams<NdmNvrPageQuery>, signal?: AbortSignal) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmNvrResultVO>>(`${prefix}/api/ndm/ndmNvr/page`, pageQuery);
const resp = await ndmClient.post<PageResult<NdmNvrResultVO>>(`${prefix}/api/ndm/ndmNvr/page`, pageQuery, { signal });
const [err, ndmNvrData] = resp;
if (err || !ndmNvrData) {
throw err;