Merged in fix/profile-validation (pull request #488)

fix: default language if missing in profile

Approved-by: Michael Zetterberg
Approved-by: Tobias Johansson
Approved-by: Arvid Norlin
Approved-by: Matilda Landström
This commit is contained in:
Christel Westerberg
2024-08-26 08:59:06 +00:00
committed by Michael Zetterberg
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: "",