Improved UI for clients and ensured function of all current APIs

This commit is contained in:
Logan Cusano
2025-05-26 01:21:37 -04:00
parent 30707fc0d5
commit 7e55c120b1
2 changed files with 135 additions and 11 deletions

View File

@@ -113,7 +113,7 @@ const BotsManagement: React.FC<BotsManagementProps> = ({ token }) => {
guild_ids: newIdData.guild_ids.split(',').map(id => id.trim()).filter(id => id),
};
const method = editingId ? 'PUT' : 'POST';
const url = editingId ? `${API_BASE_URL}/discord_ids/${editingId._id}` : `${API_BASE_URL}/discord_ids/`;
const url = editingId ? `${API_BASE_URL}/bots/token/${editingId._id}` : `${API_BASE_URL}/bots/token`;
const response = await fetch(url, {
method,
@@ -147,7 +147,7 @@ const BotsManagement: React.FC<BotsManagementProps> = ({ token }) => {
if (!window.confirm('Are you sure you want to delete this Discord ID?')) return;
setError('');
try {
const response = await fetch(`${API_BASE_URL}/discord_ids/${id}`, {
const response = await fetch(`${API_BASE_URL}/bots/token/${id}`, {
method: 'DELETE',
headers: { Authorization: `Bearer ${token}` },
});
@@ -274,7 +274,7 @@ const BotsManagement: React.FC<BotsManagementProps> = ({ token }) => {
<TableCell>{dId.discord_id}</TableCell>
<TableCell className="truncate max-w-xs">{dId.token ? dId.token.substring(0, 8) + '...' : 'N/A'}</TableCell>
<TableCell>{dId.active ? 'Yes' : 'No'}</TableCell>
<TableCell>{dId.guild_ids.join(', ')}</TableCell>
<TableCell>{dId.guild_ids?.join(', ')}</TableCell>
<TableCell>
<Button variant="outline" size="sm" className="mr-2"
onClick={() => {
@@ -284,7 +284,7 @@ const BotsManagement: React.FC<BotsManagementProps> = ({ token }) => {
name: dId.name,
token: dId.token,
active: dId.active,
guild_ids: dId.guild_ids.join(', '),
guild_ids: dId.guild_ids?.join(', '),
});
setIsAddIdDialogOpen(true);
}}>