don't get parties or activeparty if we don't have a valid user

This commit is contained in:
Holly Stubbs 2024-05-14 21:24:47 +01:00
parent 86269e624b
commit 70f23d750b
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -81,9 +81,9 @@ fastify.get("/", async (req, res) => {
let session:SessionUser | undefined;
if (session = validateSession(req.cookies)) {
const user = await UserService.GetUser(session.userId);
const parties = await UserService.GetUserParties(session.userId);
const activeUserParty = await UserService.GetActiveParty(session.userId);
if (user) {
const parties = await UserService.GetUserParties(session.userId);
const activeUserParty = await UserService.GetActiveParty(session.userId);
return res.view("templates/home.ejs", { user, parties, activeUserParty });
}