23 lines
951 B
TypeScript
23 lines
951 B
TypeScript
import { ndmClient } from '@/apis/client';
|
|
import type { PageParams, NdmDecoderPageQuery, PageResult, NdmDecoderResultVO, NdmDecoderUpdateVO } from '@/apis/models';
|
|
|
|
export const postNdmDecoderPage = async (stationCode: string, pageQuery: PageParams<NdmDecoderPageQuery>, signal?: AbortSignal) => {
|
|
const prefix = stationCode ? `/${stationCode}` : '';
|
|
const resp = await ndmClient.post<PageResult<NdmDecoderResultVO>>(`${prefix}/api/ndm/ndmDecoder/page`, pageQuery, { signal });
|
|
const [err, ndmDecoderData] = resp;
|
|
if (err || !ndmDecoderData) {
|
|
throw err;
|
|
}
|
|
return ndmDecoderData;
|
|
};
|
|
|
|
export const putNdmDecoder = async (stationCode: string, updateVO: NdmDecoderUpdateVO) => {
|
|
const prefix = stationCode ? `/${stationCode}` : '';
|
|
const resp = await ndmClient.put<NdmDecoderResultVO>(`${prefix}/api/ndm/ndmDecoder`, updateVO);
|
|
const [err, ndmDecoder] = resp;
|
|
if (err || !ndmDecoder) {
|
|
throw err;
|
|
}
|
|
return ndmDecoder;
|
|
};
|