Merged in feat/book-245-preferred-lang-redirect (pull request #2861)
Feat/book 245 preferred lang redirect * added cookie to save preferredLang and middleware to route accordingly * Cleaned up code, added noValidLang.ts middleware * cleaned a little more * Added headers in languageRedirect and set language cookie maxAge to 1 year Approved-by: Linus Flood
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
"use server"
|
||||
import { cookies } from "next/headers"
|
||||
|
||||
export async function setLanguageCookie(preferredLang: string) {
|
||||
const cookieStore = await cookies()
|
||||
cookieStore.set("preferredLang", preferredLang, {
|
||||
maxAge: 60 * 60 * 24 * 365, // 1 year
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user