Browse Source

证书大部分接口完成

main
lk 3 months ago
parent
commit
c6887156f0
  1. 4
      src/pages/websites/cert/apply.tsx
  2. 4
      src/service/websites.ts
  3. 20
      src/store/websites/cert.ts

4
src/pages/websites/cert/apply.tsx

@ -408,11 +408,11 @@ const Apply = () => {
if (applyTxtCertificateIsSuccess) { if (applyTxtCertificateIsSuccess) {
const status = (applyTxtCertificateData as any)?.data?.item[0]?.status || 0; const status = (applyTxtCertificateData as any)?.data?.item[0]?.status || 0;
const status_txt = (applyTxtCertificateData as any)?.data?.item[0]?.status_txt||""; const status_txt = (applyTxtCertificateData as any)?.data?.item[0]?.status_txt||"";
if (status || status === 5) {
if (status === 5) {
message.error(status_txt); message.error(status_txt);
} else { } else {
message.success(status_txt); message.success(status_txt);
navigate({ to: `/client/cert/management` }); // 确保路径正确
navigate({ to: `/cert/management` }); // 确保路径正确
} }
} }
}, [applyTxtCertificateIsSuccess]); }, [applyTxtCertificateIsSuccess]);

4
src/service/websites.ts

@ -16,8 +16,8 @@ const websitesServ = {
return request.get<any, any>("/cert/apply/acme/key"); return request.get<any, any>("/cert/apply/acme/key");
}, },
// 申请list // 申请list
getCertList: async (arams: any) => {
return request.post<any, any>("/cert/apply/list");
getCertList: async (params: any) => {
return request.post<any, any>("/cert/apply/list",params);
}, },
// 证书续签 // 证书续签
renewCertificate: async (params: any) => { renewCertificate: async (params: any) => {

20
src/store/websites/cert.ts

@ -196,18 +196,22 @@ export const getCertificateLogsAtom = (data: req_CertLogs) =>
}; };
}); });
export const downloadCertificateAtom = (params: Req_DownloadCert) =>
atomWithQuery<IApiResult, any>(() => {
return {
queryKey: ["downloadCertificate", params],
export const downloadCertificateAtom = (
params: Req_DownloadCert,
enableFetchAtom: boolean
) => {
return atomWithQuery(() => ({
queryKey: ['downloadCertificate', params],
queryFn: async ({ queryKey: [, params] }) => { queryFn: async ({ queryKey: [, params] }) => {
return await websitesServ.cert.downloadCertificate(params); return await websitesServ.cert.downloadCertificate(params);
}, },
select: (res) => {
return res.data;
},
enabled: enableFetchAtom, // 通过 enableFetchAtom 控制是否启用查询
}));
}; };
});
export const deletesCertificateAtom = (params: Req_DeletesCert) => export const deletesCertificateAtom = (params: Req_DeletesCert) =>
atomWithQuery<IApiResult, any>(() => { atomWithQuery<IApiResult, any>(() => {
return { return {

Loading…
Cancel
Save