mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 17:30:06 +00:00
feat(ui): updated api changes made
This commit is contained in:
@@ -25,9 +25,9 @@ export const useCreateDynamicSecretLease = () => {
|
||||
);
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { path, environment, projectSlug, slug }) => {
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug, dynamicSecretName }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environment, slug })
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environmentSlug, dynamicSecretName })
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -44,9 +44,9 @@ export const useRenewDynamicSecretLease = () => {
|
||||
);
|
||||
return data.lease;
|
||||
},
|
||||
onSuccess: (_, { path, environment, projectSlug, slug }) => {
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug, dynamicSecretName }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environment, slug })
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environmentSlug, dynamicSecretName })
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -63,9 +63,9 @@ export const useRevokeDynamicSecretLease = () => {
|
||||
);
|
||||
return data.lease;
|
||||
},
|
||||
onSuccess: (_, { path, environment, projectSlug, slug }) => {
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug, dynamicSecretName }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environment, slug })
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environmentSlug, dynamicSecretName })
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,27 +5,27 @@ import { apiRequest } from "@app/config/request";
|
||||
import { TDynamicSecretLease, TListDynamicSecretLeaseDTO } from "./types";
|
||||
|
||||
export const dynamicSecretLeaseKeys = {
|
||||
list: ({ projectSlug, environment, path, slug }: TListDynamicSecretLeaseDTO) =>
|
||||
[{ projectSlug, environment, path, slug }, "dynamic-secret-leases"] as const
|
||||
list: ({ projectSlug, environmentSlug, path, dynamicSecretName }: TListDynamicSecretLeaseDTO) =>
|
||||
[{ projectSlug, environmentSlug, path, dynamicSecretName }, "dynamic-secret-leases"] as const
|
||||
};
|
||||
|
||||
export const useGetDynamicSecretLeases = ({
|
||||
projectSlug,
|
||||
environment,
|
||||
environmentSlug,
|
||||
path,
|
||||
slug,
|
||||
dynamicSecretName,
|
||||
enabled = true
|
||||
}: TListDynamicSecretLeaseDTO) => {
|
||||
return useQuery({
|
||||
queryKey: dynamicSecretLeaseKeys.list({ path, environment, projectSlug, slug }),
|
||||
enabled: Boolean(projectSlug && environment && path && slug && enabled),
|
||||
queryKey: dynamicSecretLeaseKeys.list({ path, environmentSlug, projectSlug, dynamicSecretName }),
|
||||
enabled: Boolean(projectSlug && environmentSlug && path && dynamicSecretName && enabled),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<{ leases: TDynamicSecretLease[] }>(
|
||||
`/api/v1/dynamic-secrets/${slug}/leases`,
|
||||
`/api/v1/dynamic-secrets/${dynamicSecretName}/leases`,
|
||||
{
|
||||
params: {
|
||||
projectSlug,
|
||||
environment,
|
||||
environmentSlug,
|
||||
path
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,35 +14,35 @@ export type TDynamicSecretLease = {
|
||||
};
|
||||
|
||||
export type TCreateDynamicSecretLeaseDTO = {
|
||||
slug: string;
|
||||
dynamicSecretName: string;
|
||||
projectSlug: string;
|
||||
ttl?: string;
|
||||
path: string;
|
||||
environment: string;
|
||||
environmentSlug: string;
|
||||
};
|
||||
|
||||
export type TRenewDynamicSecretLeaseDTO = {
|
||||
leaseId: string;
|
||||
slug: string;
|
||||
dynamicSecretName: string;
|
||||
ttl?: string;
|
||||
projectSlug: string;
|
||||
path: string;
|
||||
environment: string;
|
||||
environmentSlug: string;
|
||||
};
|
||||
|
||||
export type TListDynamicSecretLeaseDTO = {
|
||||
slug: string;
|
||||
dynamicSecretName: string;
|
||||
projectSlug: string;
|
||||
path: string;
|
||||
environment: string;
|
||||
environmentSlug: string;
|
||||
enabled?: boolean;
|
||||
};
|
||||
|
||||
export type TRevokeDynamicSecretLeaseDTO = {
|
||||
leaseId: string;
|
||||
slug: string;
|
||||
dynamicSecretName: string;
|
||||
projectSlug: string;
|
||||
path: string;
|
||||
environment: string;
|
||||
environmentSlug: string;
|
||||
isForced?: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user