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