mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
33 lines
722 B
JavaScript
33 lines
722 B
JavaScript
import SecurityClient from "~/utilities/SecurityClient";
|
|
|
|
import { PATH } from "../../../const";
|
|
|
|
/**
|
|
* This function change the access of a user in a certain workspace
|
|
* @param {*} membershipId
|
|
* @param {*} role
|
|
* @returns
|
|
*/
|
|
const changeUserRoleInWorkspace = (membershipId, role) => {
|
|
return SecurityClient.fetchCall(
|
|
PATH + "/api/v1/membership/" + membershipId + "/change-role",
|
|
{
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify({
|
|
role: role,
|
|
}),
|
|
}
|
|
).then(async (res) => {
|
|
if (res.status == 200) {
|
|
return res;
|
|
} else {
|
|
console.log("Failed to change the user role in a project");
|
|
}
|
|
});
|
|
};
|
|
|
|
export default changeUserRoleInWorkspace;
|