Merged in feat/remove-date-input-from-sas-link-flow (pull request #1328)

Remove date input from SAS link flow

Approved-by: Linus Flood
This commit is contained in:
Anton Gunnarsson
2025-02-13 13:30:46 +00:00
parent d6f32bef7c
commit 419d21b3d0
9 changed files with 82 additions and 71 deletions

View File

@@ -14,33 +14,16 @@ export default async function SASxScandicLinkPage({
}: PageArgs<LangParams>) {
const profile = await getProfileSafely()
// TODO actually check if profile is already linked
// TODO check if already linked
const alreadyLinked = false
async function handleLinkAccount(dateOfBirth: string) {
"use server"
if (dateOfBirth !== profile?.dateOfBirth) {
// TODO update users date of birth here
console.log("updating date of birth")
}
return {
redirectUrl: `/${params.lang}/sas-x-scandic/login?intent=link`,
success: true,
}
}
if (alreadyLinked) {
redirect(`/${params.lang}/sas-x-scandic/error?errorCode=alreadyLinked`)
}
return (
<SASModal>
<LinkAccountForm
initialDateOfBirth={profile?.dateOfBirth ?? null}
onSubmit={handleLinkAccount}
/>
<LinkAccountForm userDateOfBirth={profile?.dateOfBirth ?? null} />
</SASModal>
)
}