From c6887156f08ce99b4bbc1af653d6262f1ef693c7 Mon Sep 17 00:00:00 2001 From: lk Date: Tue, 10 Sep 2024 14:35:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=81=E4=B9=A6=E5=A4=A7=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/websites/cert/apply.tsx | 4 ++-- src/service/websites.ts | 4 ++-- src/store/websites/cert.ts | 28 ++++++++++++++++------------ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/pages/websites/cert/apply.tsx b/src/pages/websites/cert/apply.tsx index 9b309c7..ae591ee 100644 --- a/src/pages/websites/cert/apply.tsx +++ b/src/pages/websites/cert/apply.tsx @@ -408,11 +408,11 @@ const Apply = () => { if (applyTxtCertificateIsSuccess) { const status = (applyTxtCertificateData as any)?.data?.item[0]?.status || 0; const status_txt = (applyTxtCertificateData as any)?.data?.item[0]?.status_txt||""; - if (status || status === 5) { + if (status === 5) { message.error(status_txt); } else { message.success(status_txt); - navigate({ to: `/client/cert/management` }); // 确保路径正确 + navigate({ to: `/cert/management` }); // 确保路径正确 } } }, [applyTxtCertificateIsSuccess]); diff --git a/src/service/websites.ts b/src/service/websites.ts index 81ba014..a5db4c1 100644 --- a/src/service/websites.ts +++ b/src/service/websites.ts @@ -16,8 +16,8 @@ const websitesServ = { return request.get("/cert/apply/acme/key"); }, // 申请list - getCertList: async (arams: any) => { - return request.post("/cert/apply/list"); + getCertList: async (params: any) => { + return request.post("/cert/apply/list",params); }, // 证书续签 renewCertificate: async (params: any) => { diff --git a/src/store/websites/cert.ts b/src/store/websites/cert.ts index 682f63e..8dcf4c1 100644 --- a/src/store/websites/cert.ts +++ b/src/store/websites/cert.ts @@ -196,18 +196,22 @@ export const getCertificateLogsAtom = (data: req_CertLogs) => }; }); -export const downloadCertificateAtom = (params: Req_DownloadCert) => - atomWithQuery(() => { - return { - queryKey: ["downloadCertificate", params], - queryFn: async ({ queryKey: [, params] }) => { - return await websitesServ.cert.downloadCertificate(params); - }, - select: (res) => { - return res.data; - }, - }; - }); + +export const downloadCertificateAtom = ( + params: Req_DownloadCert, + enableFetchAtom: boolean +) => { + return atomWithQuery(() => ({ + queryKey: ['downloadCertificate', params], + queryFn: async ({ queryKey: [, params] }) => { + return await websitesServ.cert.downloadCertificate(params); + }, + enabled: enableFetchAtom, // 通过 enableFetchAtom 控制是否启用查询 + })); +}; + + + export const deletesCertificateAtom = (params: Req_DeletesCert) => atomWithQuery(() => { return {