import React from 'react'; import useSWR from 'swr'; import LoadingSpinner from '../Common/LoadingSpinner'; import type { User } from '../../../server/entity/User'; import Badge from '../Common/Badge'; import { FormattedDate } from 'react-intl'; import Button from '../Common/Button'; import { hasPermission } from '../../../server/lib/permissions'; import { Permission } from '../../hooks/useUser'; import { useRouter } from 'next/router'; const UserList: React.FC = () => { const router = useRouter(); const { data, error } = useSWR('/api/v1/user'); if (!data && !error) { return ; } return ( <>

User List

{data?.map((user) => ( ))}
Name Total Requests User Type Role Created Last Updated
{user.username}
{user.email}
{user.requests.length}
Plex User {hasPermission(Permission.ADMIN, user.permissions) ? 'Admin' : 'User'}
); }; export default UserList;