import kotlinx.html.*
fun ApplicationCall.page(pageTitle: String, navBar: List<NavItem>? = null, sidebar: Sidebar? = null, content: SECTIONS.() -> Unit): HTML.() -> Unit {
- val theme = request.cookies["factbook-theme"]
+ val theme = request.cookies["FACTBOOK_THEME"]
return {
when (theme) {
import kotlinx.html.*
suspend fun ApplicationCall.changeThemePage(): HTML.() -> Unit {
- val theme = when (request.cookies["factbook-theme"]) {
+ val theme = when (request.cookies["FACTBOOK_THEME"]) {
"light" -> "light"
"dark" -> "dark"
else -> null
"dark" -> "dark"
else -> "system"
}
- response.cookies.append("factbook-theme", newTheme, maxAge = Int.MAX_VALUE.toLong())
+ response.cookies.append("FACTBOOK_THEME", newTheme, maxAge = Int.MAX_VALUE.toLong())
redirect("/change-theme")
}