Optimize usage of cookie preferences

This commit is contained in:
Zed
2020-06-09 16:45:21 +02:00
parent 310c5e936d
commit db45433ec4
13 changed files with 88 additions and 52 deletions

View File

@@ -17,8 +17,10 @@ proc findThemes*(dir: string): seq[string] =
proc createPrefRouter*(cfg: Config) =
router preferences:
get "/settings":
let html = renderPreferences(cookiePrefs(), refPath(), findThemes(cfg.staticDir))
resp renderMain(html, request, cfg, "Preferences")
let
prefs = cookiePrefs()
html = renderPreferences(prefs, refPath(), findThemes(cfg.staticDir))
resp renderMain(html, request, cfg, prefs, "Preferences")
get "/settings/@i?":
redirect("/settings")