feat: add login and print user object on my-pages

This commit is contained in:
Arvid Norlin
2024-03-11 17:27:57 +01:00
committed by Simon Emanuelsson
parent f1278a8d11
commit 70f9c22410
19 changed files with 396 additions and 46 deletions

View File

@@ -1,4 +1,4 @@
import { langEnum } from "@/types/lang"
import { langEnum, type Lang } from "@/types/lang"
export const localeToLang = {
en: langEnum.en,
@@ -39,3 +39,13 @@ export const localeToLang = {
"nn-NO": langEnum.no,
"se-NO": langEnum.no,
}
export const DEFAULT_LOCALE = "en"
export const locales: Lang[] = ["da", "de", DEFAULT_LOCALE, "fi", "no", "sv"]
export function findLocale(pathname: string) {
let locale = locales.find(
(loc) => pathname.startsWith(`/${loc}/`) || pathname === `/${loc}`
)
return locale
}