Show new workspace role on change

This commit is contained in:
Philipinho
2024-07-22 16:35:00 +01:00
parent 407a1aff3b
commit 2bd6422a35
2 changed files with 4 additions and 3 deletions

View File

@ -23,7 +23,7 @@ const RoleButton = forwardRef<HTMLButtonElement, RoleButtonProps>(
), ),
); );
interface SpaceRoleMenuProps { interface RoleMenuProps {
roles: IRoleData[]; roles: IRoleData[];
roleName: string; roleName: string;
onChange?: (value: string) => void; onChange?: (value: string) => void;
@ -35,7 +35,7 @@ export default function RoleSelectMenu({
roleName, roleName,
onChange, onChange,
disabled, disabled,
}: SpaceRoleMenuProps) { }: RoleMenuProps) {
return ( return (
<Menu withArrow> <Menu withArrow>
<Menu.Target> <Menu.Target>

View File

@ -53,9 +53,10 @@ export function useChangeMemberRoleMutation() {
return useMutation<any, Error, any>({ return useMutation<any, Error, any>({
mutationFn: (data) => changeMemberRole(data), mutationFn: (data) => changeMemberRole(data),
onSuccess: (data, variables) => { onSuccess: (data, variables) => {
// TODO: change in cache instead
notifications.show({ message: "Member role updated successfully" }); notifications.show({ message: "Member role updated successfully" });
queryClient.refetchQueries({ queryClient.refetchQueries({
queryKey: ["workspaceMembers", variables.spaceId], queryKey: ["workspaceMembers"],
}); });
}, },
onError: (error) => { onError: (error) => {