fix: default language if missing in profile

This commit is contained in:
Christel Westerberg
2024-08-26 10:42:55 +02:00
parent e3b97fcdf9
commit 231edbe944
5 changed files with 24 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ import { FormProvider, useForm } from "react-hook-form"
import { usePhoneInput } from "react-international-phone"
import { useIntl } from "react-intl"
import { type Lang, langToApiLang } from "@/constants/languages"
import { profile } from "@/constants/routes/myPages"
import { trpc } from "@/lib/trpc/client"
@@ -25,7 +26,6 @@ import {
type EditFormProps,
Status,
} from "@/types/components/myPages/myProfile/edit"
import type { Lang } from "@/constants/languages"
const formId = "edit-profile"
@@ -61,7 +61,7 @@ export default function Form({ user }: EditFormProps) {
},
dateOfBirth: user.dateOfBirth,
email: user.email,
language: user.language,
language: user.language ?? langToApiLang[lang],
phoneNumber: phoneInput,
password: "",
newPassword: "",