sort the role list alfabaticlly (#346)

This commit is contained in:
Erik Jan de Wit 2021-01-31 19:07:06 +01:00 committed by GitHub
parent 64f622139c
commit 45a6f9923d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,7 +110,19 @@ export const ClientDetails = () => {
const [client, setClient] = useState<ClientRepresentation>();
const loader = async () => {
return await adminClient.clients.listRoles({ id });
const roles = await adminClient.clients.listRoles({ id });
return roles.sort((r1, r2) => {
const r1Name = r1.name?.toUpperCase();
const r2Name = r2.name?.toUpperCase();
if (r1Name! < r2Name!) {
return -1;
}
if (r1Name! > r2Name!) {
return 1;
}
return 0;
});
};
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({