mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 11:27:47 +00:00
Leave project mutation
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
export {
|
export {
|
||||||
useAddGroupToWorkspace,
|
useAddGroupToWorkspace,
|
||||||
useDeleteGroupFromWorkspace,
|
useDeleteGroupFromWorkspace,
|
||||||
|
useLeaveProject,
|
||||||
useUpdateGroupWorkspaceRole
|
useUpdateGroupWorkspaceRole
|
||||||
} from "./mutations";
|
} from "./mutations";
|
||||||
export {
|
export {
|
||||||
@@ -30,4 +31,5 @@ export {
|
|||||||
useUpdateIdentityWorkspaceRole,
|
useUpdateIdentityWorkspaceRole,
|
||||||
useUpdateUserWorkspaceRole,
|
useUpdateUserWorkspaceRole,
|
||||||
useUpdateWsEnvironment,
|
useUpdateWsEnvironment,
|
||||||
useUpgradeProject} from "./queries";
|
useUpgradeProject
|
||||||
|
} from "./queries";
|
||||||
|
|||||||
@@ -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`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user