Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/play/geoword/admin/manage-payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ document.getElementById('record-payment-form').addEventListener('submit', event
switch (response.status) {
case 200: return window.location.reload();
case 400: return window.alert('User not found');
case 404: return window.alert('Packet not found');
default: return window.alert('Something went wrong. Please try again.');
}
});
Expand Down
3 changes: 3 additions & 0 deletions routes/api/geoword/admin/record-payment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import getCost from '../../../../database/geoword/get-cost.js';
import recordPayment from '../../../../database/geoword/record-payment.js';
import getUserId from '../../../../database/account-info/get-user-id.js';
import getPacketStatus from '../../../../database/geoword/get-packet-status.js';

import { Router } from 'express';

Expand All @@ -9,6 +10,8 @@ const router = Router();
router.put('/', async (req, res) => {
const { packetName, username } = req.body;

if (await getPacketStatus(packetName) === null) { return res.status(404).send('Packet not found'); }

const userId = await getUserId(username);
if (!userId) { return res.status(400).send('User not found'); }

Expand Down
Loading