From 1c12d378d66b92b1674acd17640f2bac752da289 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 25 Mar 2025 14:13:06 -0400 Subject: Converted public dashboard to admin dashboard; Made API have a consistent output message --- bot/src/api/routes/settings.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bot/src/api/routes/settings.js') diff --git a/bot/src/api/routes/settings.js b/bot/src/api/routes/settings.js index bdef633..794d302 100644 --- a/bot/src/api/routes/settings.js +++ b/bot/src/api/routes/settings.js @@ -6,7 +6,7 @@ import { verifyToken } from './auth.js'; export function settingsRouter(client) { const router = Router(); - router.get('/settings/guild/:id', verifyToken, async (req, res) => { + router.get('/settings/guilds/:id', verifyToken, async (req, res) => { try { const settings = await guildSettings.findOne({ where: { guildID: req.params.id } }); @@ -38,11 +38,11 @@ export function settingsRouter(client) { }); } catch (e) { console.error('Error fetching settings:', e); - res.status(500).send('Internal Server Error'); + res.status(500).send({ message: 'Internal Server Error' }); } }); - router.post('/settings/guild/:id', verifyToken, async (req, res) => { + router.post('/settings/guilds/:id', verifyToken, async (req, res) => { try { const guildID = req.params.id; const { ...newSettings } = req.body; @@ -51,11 +51,11 @@ export function settingsRouter(client) { const updatedSettings = await guildSettings.findOne({ where: { guildID: guildID } }); res.json(updatedSettings); } else { - res.status(404).send('Settings not found'); + res.status(404).send({ message: 'Settings not found' }); } } catch (e) { console.error('Error updating settings:', e); - res.status(500).send('Internal Server Error'); + res.status(500).send({ message: 'Internal Server Error' }); } }); -- cgit v1.2.3