fix: default language if missing in profile
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { languageSelect } from "@/constants/languages"
|
||||
import { languages, languageSelect } from "@/constants/languages"
|
||||
import { profileEdit } from "@/constants/routes/myPages"
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
@@ -29,6 +29,8 @@ export default async function Profile({ params }: PageArgs<LangParams>) {
|
||||
if (!user || "error" in user) {
|
||||
return null
|
||||
}
|
||||
|
||||
const defaultLanguage = languages[params.lang]
|
||||
const language = languageSelect.find((l) => l.value === user.language)
|
||||
return (
|
||||
<>
|
||||
@@ -68,7 +70,7 @@ export default async function Profile({ params }: PageArgs<LangParams>) {
|
||||
<Body color="burgundy" textTransform="bold">
|
||||
{formatMessage({ id: "Language" })}
|
||||
</Body>
|
||||
<Body color="burgundy">{language?.label ?? "N/A"}</Body>
|
||||
<Body color="burgundy">{language?.label ?? defaultLanguage}</Body>
|
||||
</div>
|
||||
<div className={styles.item}>
|
||||
<EmailIcon color="burgundy" />
|
||||
|
||||
Reference in New Issue
Block a user