import { httpErrorToHuman } from '@/api/http'; import FlashMessageRender from '@/components/FlashMessageRender'; import useFlash from '@/plugins/useFlash'; import React, { useEffect, useState } from 'react'; import Button from '@/components/elements/Button'; import tw from 'twin.macro'; import AdminContentBlock from '@/components/admin/AdminContentBlock'; import Spinner from '@/components/elements/Spinner'; import getRoles, { Role } from '@/api/admin/roles/getRoles'; export default () => { const { clearFlashes, addError } = useFlash(); const [ loading, setLoading ] = useState(true); const [ roles, setRoles ] = useState([]); useEffect(() => { clearFlashes('roles'); getRoles() .then(roles => setRoles(roles)) .catch(error => { addError({ message: httpErrorToHuman(error), key: 'roles' }); console.error(error); }) .then(() => setLoading(false)); }, []); return (

Roles

Soon™

{ loading ?
: roles.length < 1 ?
{'No

No items could be found, it's almost like they are hiding.

:
{ roles.map(role => ( )) }
ID Name Description
{role.id} {role.name} {role.description}
}
); };