fix: Cannot remove user from collection in beta sharing UI

This commit is contained in:
Tom Moor
2024-05-29 20:04:20 -04:00
parent 5e841f6b16
commit 4b1b87abde

View File

@@ -146,18 +146,20 @@ function CollectionMemberList({ collection, invitedInSession }: Props) {
<InputMemberPermissionSelect
style={{ margin: 0 }}
permissions={permissions}
onChange={async (permission: CollectionPermission) => {
if (permission) {
onChange={async (
permission: CollectionPermission | typeof EmptySelectValue
) => {
if (permission === EmptySelectValue) {
await memberships.delete({
collectionId: collection.id,
userId: membership.userId,
});
} else {
await memberships.create({
collectionId: collection.id,
userId: membership.userId,
permission,
});
} else {
await memberships.delete({
collectionId: collection.id,
userId: membership.userId,
});
}
}}
disabled={!can.update}