Merged in fix/too-many-codes-error (pull request #1814)
Fix SAS OTP rate limited error * Fix error for too many codes not showing up Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -83,9 +83,7 @@ export async function GET(
|
||||
stateResult.data.intent === "unlink" ||
|
||||
stateResult.data.intent === "transfer"
|
||||
) {
|
||||
const [data, error] = await safeTry(
|
||||
serverClient().partner.sas.requestOtp({})
|
||||
)
|
||||
const [data, error] = await safeTry(serverClient().partner.sas.requestOtp())
|
||||
if (!data || error) {
|
||||
console.error("[SAS] Failed to request OTP", error)
|
||||
redirect(`/${lang}/sas-x-scandic/error`)
|
||||
@@ -93,12 +91,13 @@ export async function GET(
|
||||
|
||||
switch (data.status) {
|
||||
case "ABUSED":
|
||||
redirect(`/${params.lang}/sas-x-scandic/error?errorCode=tooManyCodes`)
|
||||
case "NOTSENT":
|
||||
redirect(`/${params.lang}/sas-x-scandic/error`)
|
||||
redirect(`/${params.lang}/sas-x-scandic/error?errorCode=tooManyCodes`)
|
||||
case "NULL":
|
||||
case "RETRY":
|
||||
case "EXPIRED":
|
||||
case "PENDING":
|
||||
case "VERIFIED":
|
||||
// These errors should never happen for request, but according to the API spec they can
|
||||
throw new Error(`Unhandled request OTP status ${data.status}`)
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ export default function OneTimePasswordForm({
|
||||
|
||||
setOtp("")
|
||||
requestOtp.reset()
|
||||
requestOtp.mutate({})
|
||||
requestOtp.mutate()
|
||||
setDisableResend(true)
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user