我是歌谣 放弃很容易 但是坚持一定很酷 微信公众号关注前端小歌谣带你进入前端技术群
const GrantAdminPermissionsButton = () => {
const record = useRecordContext();
const [ update ] = useUpdate();
const { refetch } = usePermissions();
const handleClick = () => {
update(
"users",
{ id: record.id, data: { admin: true }, previousData: record },
{ onSuccess: refetch },
);
}
return (
<Button onClick={handleClick}>
Make user an admin
</Button>
)
}