fix: add tab helper for highlighting the active guild tab

This commit is contained in:
Corban-Lee Jones 2025-04-22 16:03:59 +01:00
parent c1cf78bf96
commit 119339c0a3

View File

@ -0,0 +1,10 @@
import { Request, Response, NextFunction } from "express";
// This middleware returns the last segment of the url path.
// It's used to identify which tab to highlight as active on
// the guild view at '/guild/<id>/<page>'
export const guildTabHelper = (request: Request, response: Response, next: NextFunction) => {
const currentPath = request.path.split("/")
response.locals.guildPage = currentPath[currentPath.length - 1]
next();
}