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. 28
      src/store/websites/cert.ts

4
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]);

4
src/service/websites.ts

@ -16,8 +16,8 @@ const websitesServ = {
return request.get<any, any>("/cert/apply/acme/key");
},
// 申请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) => {

28
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],
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<IApiResult, any>(() => {
return {

Loading…
Cancel
Save