Skip to content

Commit

Permalink
pulsanti users
Browse files Browse the repository at this point in the history
to give and remove admin
  • Loading branch information
paolini committed Jan 19, 2024
1 parent 1c14fec commit 60109b0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions frontend/src/pages/UsersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ export default function UsersPage({engine}) {
<ItemAddButton>
Aggiungi utente
</ItemAddButton>
<button type="button" className="btn btn-sm btn-danger mr-2"
onClick={() => set_admin(true)} disabled={!selectedIds.length}>
<span className="d-none d-md-inline ml-2">
rendi admin
</span>
</button>
<button type="button" className="btn btn-sm btn-danger mr-2"
onClick={() => set_admin(false)} disabled={!selectedIds.length}>
<span className="d-none d-md-inline ml-2">
rimuovi da admin
</span>
</button>

<TableTopRightButtons>
<CsvDownloadButton cb={async (query)=>[]}/>
Expand All @@ -50,6 +62,12 @@ export default function UsersPage({engine}) {
<td>{item.admin ? "•" : ""}</td>
</>
}

async function set_admin(admin) {
for (const id of selectedIds) {
await patcher.mutate({_id: id, admin: admin})
}
}
}

function Headers() {
Expand Down

0 comments on commit 60109b0

Please sign in to comment.