This commit is contained in:
Christopher Cookman 2025-10-03 22:12:07 -06:00
parent 616bf2f29a
commit aa6ceb46b5

View file

@ -594,11 +594,13 @@ app.patch('/api/v1/user/update', async (req, res) => { // Update users server, p
const apiKey = req.headers['authorization']; const apiKey = req.headers['authorization'];
console.log(`API Key: ${apiKey}`); console.log(`API Key: ${apiKey}`);
if (!apiKey) { if (!apiKey) {
res.status(401).json({ error: 'Unauthorized' }); console.log("No API key provided");
res.status(401).json({ error: 'API Key is required!' });
return; return;
} }
const oldData = await pool.query("SELECT * FROM routes WHERE apiKey = ?", [apiKey]); const oldData = await pool.query("SELECT * FROM routes WHERE apiKey = ?", [apiKey]);
if (!oldData || oldData.length === 0) { if (!oldData || oldData.length === 0) {
console.log("No data found for API key");
res.status(401).json({ error: 'Unauthorized' }); res.status(401).json({ error: 'Unauthorized' });
return; return;
} }