Files
infisical/frontend/pages/api/workspace/changeUserRoleInWorkspace.ts
T
2022-12-11 15:02:15 +09:00

31 lines
739 B
TypeScript

import SecurityClient from '~/utilities/SecurityClient';
/**
* This function change the access of a user in a certain workspace
* @param {*} membershipId
* @param {*} role
* @returns
*/
const changeUserRoleInWorkspace = (membershipId: string, role: string) => {
return SecurityClient.fetchCall(
'/api/v1/membership/' + membershipId + '/change-role',
{
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
role: role
})
}
).then(async (res) => {
if (res && res.status == 200) {
return res;
} else {
console.log('Failed to change the user role in a project');
}
});
};
export default changeUserRoleInWorkspace;