Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Update mutation.tsx

Daniel11cbb3f56d13
diff --git a/frontend/src/hooks/api/orgAdmin/mutation.tsx b/frontend/src/hooks/api/orgAdmin/mutation.tsx
index 9fa93722ed..9565eb417c 100644
--- a/frontend/src/hooks/api/orgAdmin/mutation.tsx
+++ b/frontend/src/hooks/api/orgAdmin/mutation.tsx
@@ -1,15 +1,22 @@
-import { useMutation } from "@tanstack/react-query";
+import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
+import { projectKeys } from "@app/hooks/api/projects/query-keys";
import { TOrgAdminAccessProjectDTO } from "./types";
-export const useOrgAdminAccessProject = () =>
- useMutation({
+export const useOrgAdminAccessProject = () => {
+ const queryClient = useQueryClient();
+
+ return useMutation({
mutationFn: async ({ projectId }: TOrgAdminAccessProjectDTO) => {
const { data } = await apiRequest.post(
`/api/v1/organization-admin/projects/${projectId}/grant-admin-access`
);
return data;
+ },
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: projectKeys.allProjectQueries() });
}
});
+};