This commit is contained in:
Gabe Kangas 2021-11-08 00:51:17 -08:00
parent 693fd3b906
commit b0541f0e66
2 changed files with 14 additions and 1 deletions

View file

@ -1,7 +1,7 @@
import React, { useState, useEffect, useContext } from 'react';
import { Typography } from 'antd';
import { ServerStatusContext } from '../../utils/server-status-context';
import { CONNECTED_CLIENTS, fetchData, DISABLED_USERS } from '../../utils/apis';
import { CONNECTED_CLIENTS, fetchData, DISABLED_USERS, MODERATORS } from '../../utils/apis';
import UserTable from '../../components/user-table';
import ClientTable from '../../components/client-table';
@ -15,6 +15,7 @@ export default function ChatUsers() {
const [disabledUsers, setDisabledUsers] = useState([]);
const [clients, setClients] = useState([]);
const [moderators, setModerators] = useState([]);
const getInfo = async () => {
try {
@ -30,6 +31,13 @@ export default function ChatUsers() {
} catch (error) {
console.log('==== error', error);
}
try {
const result = await fetchData(MODERATORS);
setModerators(result);
} catch (error) {
console.error('error fetching moderators', error);
}
};
useEffect(() => {
@ -73,6 +81,9 @@ export default function ChatUsers() {
<br />
<Title>Banned Users</Title>
<UserTable data={disabledUsers} />
<Title>Moderators</Title>
<UserTable data={moderators} />
</>
);
}

View file

@ -37,6 +37,8 @@ export const USER_ENABLED_TOGGLE = `${API_LOCATION}chat/users/setenabled`;
// Disable/enable a single user
export const USER_SET_MODERATOR = `${API_LOCATION}chat/users/setmoderator`;
// Get list of moderators
export const MODERATORS = `${API_LOCATION}chat/users/moderators`;
// Get hardware stats
export const HARDWARE_STATS = `${API_LOCATION}hardwarestats`;