Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Leave project mutation
Daniel Hougaard80e55a9341d0
diff --git a/frontend/src/hooks/api/workspace/index.tsx b/frontend/src/hooks/api/workspace/index.tsxindex 1daec0fd0f..f5e5855d40 100644--- a/frontend/src/hooks/api/workspace/index.tsx+++ b/frontend/src/hooks/api/workspace/index.tsx@@ -1,6 +1,7 @@export {useAddGroupToWorkspace,useDeleteGroupFromWorkspace,+ useLeaveProject,useUpdateGroupWorkspaceRole} from "./mutations";export {@@ -30,4 +31,5 @@ export {useUpdateIdentityWorkspaceRole,useUpdateUserWorkspaceRole,useUpdateWsEnvironment,- useUpgradeProject} from "./queries";+ useUpgradeProject+} from "./queries";diff --git a/frontend/src/hooks/api/workspace/mutations.tsx b/frontend/src/hooks/api/workspace/mutations.tsxindex 11853157f8..03f0d473d7 100644--- a/frontend/src/hooks/api/workspace/mutations.tsx+++ b/frontend/src/hooks/api/workspace/mutations.tsx@@ -62,3 +62,15 @@ export const useDeleteGroupFromWorkspace = () => {}});};++export const useLeaveProject = () => {+ return useMutation<{}, {}, { workspaceId: string; organizationId: string }>({+ mutationFn: ({ workspaceId }) => {+ return apiRequest.delete(`/api/v1/workspace/${workspaceId}/leave`);+ },+ onSuccess: (_, { organizationId }) => {+ // Invalidating the query here will cause a permission error, so we won't invalidate any queries here. Instead after leaving the workspace, we will redirect the user to the organization overview page.+ window.location.href = `/org/${organizationId}/overview`;+ }+ });+};