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
}

8
constants/myPages.js Normal file
View File

@@ -0,0 +1,8 @@
export const pageNames = {
da: "mine-sider",
de: "mein-profil",
en: "my-pages",
fi: "minun-sivujani",
no: "mine-sider",
sv: "mina-sidor",
}

10
constants/myPages.ts Normal file
View File

@@ -0,0 +1,10 @@
import type { Lang } from "@/types/lang"
export const pageNames: Record<Lang, string> = {
da: "mine-sider",
de: "mein-profil",
en: "my-pages",
fi: "minun-sivujani",
no: "mine-sider",
sv: "mina-sidor",
}