diff --git a/resources/scripts/api/admin/servers/getServers.ts b/resources/scripts/api/admin/servers/getServers.ts index daa6f2d8f..15799985a 100644 --- a/resources/scripts/api/admin/servers/getServers.ts +++ b/resources/scripts/api/admin/servers/getServers.ts @@ -49,11 +49,11 @@ interface ctx { export const Context = createContext({ page: 1, setPage: () => 1 }); -export default () => { +export default (include: string[] = []) => { const { page } = useContext(Context); return useSWR>([ 'servers', page ], async () => { - const { data } = await http.get('/api/application/servers', { params: { include: 'node,user', page } }); + const { data } = await http.get('/api/application/servers', { params: { include: include.join(','), page } }); return ({ items: (data.data || []).map(rawDataToServerObject), diff --git a/resources/scripts/components/admin/servers/ServersContainer.tsx b/resources/scripts/components/admin/servers/ServersContainer.tsx index 27b46680d..20f1d4800 100644 --- a/resources/scripts/components/admin/servers/ServersContainer.tsx +++ b/resources/scripts/components/admin/servers/ServersContainer.tsx @@ -36,7 +36,7 @@ const UsersContainer = () => { const { page, setPage } = useContext(ServersContext); const { clearFlashes, clearAndAddHttpError } = useFlash(); - const { data: servers, error, isValidating } = getServers(); + const { data: servers, error, isValidating } = getServers([ 'node', 'user' ]); useEffect(() => { if (!error) { @@ -122,7 +122,6 @@ const UsersContainer = () => { {/* TODO: Have permission check for displaying user information. */} -
{server.relations.user?.firstName} {server.relations.user?.lastName}