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:
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user