mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 23:25:26 +00:00
feat: renamed old frontend and fixed some minor bugs
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { TSshCertificateTemplate } from "../sshCertificateTemplates/types";
|
||||
import { TSshCertificateAuthority } from "./types";
|
||||
|
||||
export const sshCaKeys = {
|
||||
getSshCaById: (caId: string) => [{ caId }, "ssh-ca"],
|
||||
getSshCaCertTemplates: (caId: string) => [{ caId }, "ssh-ca-cert-templates"]
|
||||
};
|
||||
|
||||
export const useGetSshCaById = (caId: string) => {
|
||||
return useQuery({
|
||||
queryKey: sshCaKeys.getSshCaById(caId),
|
||||
queryFn: async () => {
|
||||
const {
|
||||
data: { ca }
|
||||
} = await apiRequest.get<{ ca: TSshCertificateAuthority }>(`/api/v1/ssh/ca/${caId}`);
|
||||
return ca;
|
||||
},
|
||||
enabled: Boolean(caId)
|
||||
});
|
||||
};
|
||||
|
||||
export const useGetSshCaCertTemplates = (caId: string) => {
|
||||
return useQuery({
|
||||
queryKey: sshCaKeys.getSshCaCertTemplates(caId),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<{
|
||||
certificateTemplates: TSshCertificateTemplate[];
|
||||
}>(`/api/v1/ssh/ca/${caId}/certificate-templates`);
|
||||
return data;
|
||||
},
|
||||
enabled: Boolean(caId)
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user