import { Request, Response, Router } from "express"; const router = Router(); function RenderDashboard(req: Request, res: Response) { res.renderWithTranslations('dashboard', 'dashboard', { t: req.t, username: req.mSession.GetUsername() }); } function RenderIndex(req: Request, res: Response) { res.renderWithTranslations('index', 'index', { t: (text: string) => { return req.t(text); } }); } router.get('/', (req: Request, res: Response) => { return req.mSession.IsValid() ? RenderDashboard(req, res) : RenderIndex(req, res); }); export default router;