Files
web/app/[lang]/(partner)/(sas)/(protected)/sas-x-scandic/error/page.tsx
Anton Gunnarsson 18288cb849 Merged in feat/sas-otp-error-handling (pull request #1272)
Feat/sas otp error handling

* Improve error handling for SAS OTP
* Remove failing and deprecated test

Approved-by: Joakim Jäderberg
2025-02-07 14:18:00 +00:00

52 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 well help you resolve this issue.",
})}
</Body>
<SASModalContactBlock />
</GenericError>
)
}