serve invite page

This commit is contained in:
counterweight 2025-02-09 19:38:57 +01:00
parent fe008a8906
commit 9c90b75bc0
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
3 changed files with 54 additions and 0 deletions

View file

@ -1,9 +1,30 @@
const express = require('express');
const router = express.Router();
const AppInvite = require('../models/AppInvite');
router.get('/', (req, res) => {
res.render('index', { uuid: req.cookies.sessionUuid });
});
router.get('/invite/:uuid', async (req, res) => {
const { uuid } = req.params;
try {
const invite = await AppInvite.findOne({ where: { uuid } });
if (!invite) {
return res.status(404).render('error', { message: 'Invite not found' });
}
return res.render('invite', { invite });
} catch (error) {
console.error('Error fetching invite:', error);
return res.status(500).render('error', { message: 'An error occurred' });
}
});
module.exports = router;