Only request servers as an admin if actually an admin; closes #3242

This commit is contained in:
Dane Everitt 2021-04-20 20:41:08 -07:00
parent db64f54010
commit d2955b9361
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -25,8 +25,8 @@ export default () => {
const [ showOnlyAdmin, setShowOnlyAdmin ] = usePersistedState(`${uuid}:show_all_servers`, false); const [ showOnlyAdmin, setShowOnlyAdmin ] = usePersistedState(`${uuid}:show_all_servers`, false);
const { data: servers, error } = useSWR<PaginatedResult<Server>>( const { data: servers, error } = useSWR<PaginatedResult<Server>>(
[ '/api/client/servers', showOnlyAdmin, page ], [ '/api/client/servers', (showOnlyAdmin && rootAdmin), page ],
() => getServers({ page, type: showOnlyAdmin ? 'admin' : undefined }), () => getServers({ page, type: (showOnlyAdmin && rootAdmin) ? 'admin' : undefined }),
); );
useEffect(() => { useEffect(() => {