fix: add tab helper for highlighting the active guild tab
This commit is contained in:
parent
c1cf78bf96
commit
119339c0a3
10
src/server/middleware/guildTabHelper.ts
Normal file
10
src/server/middleware/guildTabHelper.ts
Normal 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();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user