mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-17 16:27:39 +00:00
feat: changed the whole api from projectid to slug
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user