summaryrefslogtreecommitdiff
path: root/controllers/games/gameId.js
blob: c87a857904ed07e5569d365fd65a44b6e8b057e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { getGame } from "../../database/games.js";

function makePageData(user, cwdata) {
	return {
		title: "Jouer",
		user: user,
		CWDATA: cwdata,
	};
}

export function gameId_get(req, res) {
	const game = getGame(req.params.gameId);
	// TODO redirect if null
	let cwdata = game; // TODO reformat this object
	console.log(cwdata);
	return res.render("game", makePageData(req.session.user, cwdata));
}