Feat/sas otp error handling * Improve error handling for SAS OTP * Remove failing and deprecated test Approved-by: Joakim Jäderberg
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import Body from "@/components/TempDesignSystem/Text/Body"
|
||
import { getIntl } from "@/i18n"
|
||
|
||
import { AlreadyLinkedError } from "../components/AlreadyLinkedError"
|
||
import { DateOfBirthError } from "../components/DateOfBirthError"
|
||
import { GenericError } from "../components/GenericError"
|
||
import { SASModalContactBlock } from "../components/SASModal"
|
||
import { TooManyCodesError } from "../components/TooManyCodesError"
|
||
import { TooManyFailedAttemptsError } from "../components/TooManyFailedAttemptsError"
|
||
|
||
import type { LangParams, PageArgs, SearchParams } from "@/types/params"
|
||
|
||
export default async function Page({
|
||
searchParams,
|
||
params,
|
||
}: PageArgs<LangParams> & SearchParams<{ errorCode?: "dateOfBirthMismatch" }>) {
|
||
const intl = await getIntl()
|
||
|
||
const { errorCode } = searchParams
|
||
|
||
if (errorCode === "dateOfBirthMismatch") {
|
||
return <DateOfBirthError />
|
||
}
|
||
|
||
if (errorCode === "tooManyFailedAttempts") {
|
||
return <TooManyFailedAttemptsError />
|
||
}
|
||
|
||
if (errorCode === "tooManyCodes") {
|
||
return <TooManyCodesError />
|
||
}
|
||
|
||
if (errorCode === "alreadyLinked") {
|
||
return <AlreadyLinkedError />
|
||
}
|
||
|
||
return (
|
||
<GenericError
|
||
title={intl.formatMessage({
|
||
id: "We could not connect your accounts",
|
||
})}
|
||
>
|
||
<Body textAlign="center">
|
||
{intl.formatMessage({
|
||
id: "We could not connect your accounts to give you access. Please contact us and we’ll help you resolve this issue.",
|
||
})}
|
||
</Body>
|
||
<SASModalContactBlock />
|
||
</GenericError>
|
||
)
|
||
}
|