mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 22:46:24 +00:00
feat: renamed old frontend and fixed some minor bugs
This commit is contained in:
@@ -15,7 +15,7 @@ export const useCreateDynamicSecretLease = () => {
|
||||
|
||||
return useMutation<
|
||||
{ lease: TDynamicSecretLease; data: unknown },
|
||||
{},
|
||||
object,
|
||||
TCreateDynamicSecretLeaseDTO
|
||||
>({
|
||||
mutationFn: async (dto) => {
|
||||
@@ -26,9 +26,14 @@ export const useCreateDynamicSecretLease = () => {
|
||||
return data;
|
||||
},
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug, dynamicSecretName }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environmentSlug, dynamicSecretName })
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dynamicSecretLeaseKeys.list({
|
||||
path,
|
||||
projectSlug,
|
||||
environmentSlug,
|
||||
dynamicSecretName
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -36,7 +41,7 @@ export const useCreateDynamicSecretLease = () => {
|
||||
export const useRenewDynamicSecretLease = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<{}, {}, TRenewDynamicSecretLeaseDTO>({
|
||||
return useMutation<object, object, TRenewDynamicSecretLeaseDTO>({
|
||||
mutationFn: async (dto) => {
|
||||
const { data } = await apiRequest.post<{ lease: TDynamicSecretLease }>(
|
||||
`/api/v1/dynamic-secrets/leases/${dto.leaseId}/renew`,
|
||||
@@ -45,9 +50,14 @@ export const useRenewDynamicSecretLease = () => {
|
||||
return data.lease;
|
||||
},
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug, dynamicSecretName }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environmentSlug, dynamicSecretName })
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dynamicSecretLeaseKeys.list({
|
||||
path,
|
||||
projectSlug,
|
||||
environmentSlug,
|
||||
dynamicSecretName
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -55,7 +65,7 @@ export const useRenewDynamicSecretLease = () => {
|
||||
export const useRevokeDynamicSecretLease = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<{}, {}, TRevokeDynamicSecretLeaseDTO>({
|
||||
return useMutation<object, object, TRevokeDynamicSecretLeaseDTO>({
|
||||
mutationFn: async (dto) => {
|
||||
const { data } = await apiRequest.delete<{ lease: TDynamicSecretLease }>(
|
||||
`/api/v1/dynamic-secrets/leases/${dto.leaseId}`,
|
||||
@@ -64,9 +74,14 @@ export const useRevokeDynamicSecretLease = () => {
|
||||
return data.lease;
|
||||
},
|
||||
onSuccess: (_, { path, environmentSlug, projectSlug, dynamicSecretName }) => {
|
||||
queryClient.invalidateQueries(
|
||||
dynamicSecretLeaseKeys.list({ path, projectSlug, environmentSlug, dynamicSecretName })
|
||||
);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dynamicSecretLeaseKeys.list({
|
||||
path,
|
||||
projectSlug,
|
||||
environmentSlug,
|
||||
dynamicSecretName
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -17,7 +17,12 @@ export const useGetDynamicSecretLeases = ({
|
||||
enabled = true
|
||||
}: TListDynamicSecretLeaseDTO) => {
|
||||
return useQuery({
|
||||
queryKey: dynamicSecretLeaseKeys.list({ path, environmentSlug, projectSlug, dynamicSecretName }),
|
||||
queryKey: dynamicSecretLeaseKeys.list({
|
||||
path,
|
||||
environmentSlug,
|
||||
projectSlug,
|
||||
dynamicSecretName
|
||||
}),
|
||||
enabled: Boolean(projectSlug && environmentSlug && path && dynamicSecretName && enabled),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<{ leases: TDynamicSecretLease[] }>(
|
||||
@@ -35,5 +40,3 @@ export const useGetDynamicSecretLeases = ({
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -46,4 +46,3 @@ export type TRevokeDynamicSecretLeaseDTO = {
|
||||
environmentSlug: string;
|
||||
isForced?: boolean;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user