'use client' import { removeUserRole, updateUserRole } from '../../actions' import { useState } from 'react' export function UserRoleActions({ ur, orgId }: { ur: { id: string, role: string, user: { email: string } }, orgId: string }) { const [isPending, setIsPending] = useState(false) const handleRemove = async () => { if (!confirm(`Möchten Sie den Zugriff für ${ur.user.email} wirklich entfernen?`)) return setIsPending(true) await removeUserRole(ur.id, orgId) setIsPending(false) } const handleToggleRole = async () => { const newRole = ur.role === 'admin' ? 'member' : 'admin' setIsPending(true) await updateUserRole(ur.id, orgId, newRole) setIsPending(false) } return (
) }