mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-19 11:42:52 +00:00
28 lines
806 B
TypeScript
28 lines
806 B
TypeScript
import SecurityClient from "@app/components/utilities/SecurityClient";
|
|
|
|
/**
|
|
* This function change the access of a user in a certain organization
|
|
* @param {string} organizationId
|
|
* @param {string} membershipId
|
|
* @param {string} role
|
|
* @returns
|
|
*/
|
|
const changeUserRoleInOrganization = (organizationId: string, membershipId: string, role: string) =>
|
|
SecurityClient.fetchCall(`/api/v2/organizations/${organizationId}/memberships/${membershipId}`, {
|
|
method: "PATCH",
|
|
headers: {
|
|
"Content-Type": "application/json"
|
|
},
|
|
body: JSON.stringify({
|
|
role
|
|
})
|
|
}).then(async (res) => {
|
|
if (res && res.status === 200) {
|
|
return res;
|
|
}
|
|
console.log("Failed to change the user role in an org");
|
|
return undefined;
|
|
});
|
|
|
|
export default changeUserRoleInOrganization;
|