diff --git a/src/components/BotsManagement.tsx b/src/components/BotsManagement.tsx index 4fe0b56..55cb0a8 100644 --- a/src/components/BotsManagement.tsx +++ b/src/components/BotsManagement.tsx @@ -11,7 +11,7 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from ' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Checkbox } from '@/components/ui/checkbox'; import { DRB_BASE_API_URL } from '@/constants/api'; -import { DiscordId, System, ErrorResponse } from '@/types'; +import { DiscordId, System, ErrorResponse, ActiveClient } from '@/types'; import { authAwareFetch } from '@/utils/AuthAwareFetch'; interface BotsManagementProps { @@ -20,7 +20,7 @@ interface BotsManagementProps { } const BotsManagement: React.FC = ({ token, logoutUser }) => { - const [bots, setBots] = useState([]); + const [bots, setBots] = useState([]); const [discordIds, setDiscordIds] = useState([]); const [systems, setSystems] = useState([]); const [loading, setLoading] = useState(true); // Set to true initially @@ -61,7 +61,7 @@ const BotsManagement: React.FC = ({ token, logoutUser }) => ]); if (nodesRes.ok) { - const botsData: any = await nodesRes.json(); + const botsData: ActiveClient[] = await nodesRes.json(); setBots(botsData); } else { let errorMsg = `Failed to fetch bots (${nodesRes.status})`; @@ -270,12 +270,12 @@ const BotsManagement: React.FC = ({ token, logoutUser }) => {bots.length > 0 ? ( - bots.map((botClientId) => { + bots.map((active_bot) => { return ( - + - - {botClientId} + + {active_bot.nickname} ({active_bot.client_id}) @@ -420,8 +420,8 @@ const BotsManagement: React.FC = ({ token, logoutUser }) => - {bots.map((botId) => ( - {botId} + {bots.map((active_bot) => ( + {active_bot.client_id} ))} diff --git a/src/types/index.ts b/src/types/index.ts index 7fd5165..8c8e0cd 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -53,6 +53,12 @@ export enum DemodTypes { discord_status: string; } } + + export interface ActiveClient { + active_token: string; + nickname: string; + client_id: string; + } // Auth Context Types export interface AuthContextType {