diff options
| author | Andrew Lee <andrew@alee14.me> | 2025-03-25 14:13:06 -0400 |
|---|---|---|
| committer | Andrew Lee <andrew@alee14.me> | 2025-03-25 14:13:06 -0400 |
| commit | 1c12d378d66b92b1674acd17640f2bac752da289 (patch) | |
| tree | bc8a1ef5047be1ed2400f2204a0222a840375851 /bot/src/api/routes/quotes.js | |
| parent | ad768e2b25b58d62a44aa2daeb1429a651d488e5 (diff) | |
| download | AleeBot-1c12d378d66b92b1674acd17640f2bac752da289.tar.gz AleeBot-1c12d378d66b92b1674acd17640f2bac752da289.tar.bz2 AleeBot-1c12d378d66b92b1674acd17640f2bac752da289.zip | |
Converted public dashboard to admin dashboard; Made API have a consistent output message
Diffstat (limited to 'bot/src/api/routes/quotes.js')
| -rw-r--r-- | bot/src/api/routes/quotes.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/bot/src/api/routes/quotes.js b/bot/src/api/routes/quotes.js index 7f9f255..f362d7e 100644 --- a/bot/src/api/routes/quotes.js +++ b/bot/src/api/routes/quotes.js @@ -10,7 +10,7 @@ quoteRouter.get('/quotes/pending', verifyToken, async (req, res) => { res.json(quotes); } catch (error) { console.error('Error fetching quotes:', error); - res.status(500).send('Internal Server Error'); + res.status(500).send({ message: 'Internal Server Error' }); } }); @@ -24,10 +24,10 @@ quoteRouter.post('/quotes/add', verifyToken, async (req, res) => { year: year, submitter: submitterID }); - res.status(200).send('Added a new quote'); + res.status(200).send({ message: 'Added a new quote' }); } catch (error) { console.error('Something went wrong:', error); - res.status(500).send('Internal Server Error'); + res.status(500).send({ message: 'Internal Server Error' }); } }); @@ -44,13 +44,13 @@ quoteRouter.post('/quotes/approve', verifyToken, async (req, res) => { submitter: quote.submitterID }); await pendingQuote.destroy({ where: { id } }); - res.status(200).send('Quote approved'); + res.status(200).send({ message: 'Quote approved' }); } else { - res.status(404).send('Quote not found'); + res.status(404).send({ message: 'Quote not found' }); } } catch (error) { console.error('Error approving quote:', error); - res.status(500).send('Internal Server Error'); + res.status(500).send({ message: 'Internal Server Error' }); } }); @@ -60,12 +60,12 @@ quoteRouter.post('/quotes/reject', verifyToken, async (req, res) => { const quote = await pendingQuote.findByPk(id); if (quote) { await pendingQuote.destroy({ where: { id } }); - res.status(200).send('Quote rejected'); + res.status(200).send({ message: 'Quote rejected' }); } else { - res.status(404).send('Quote not found'); + res.status(404).send({ message: 'Quote not found' }); } } catch (error) { console.error('Error rejecting quote:', error); - res.status(500).send('Internal Server Error'); + res.status(500).send({ message: 'Internal Server Error' }); } }); |
