mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-04-20 03:50:20 +00:00
feat: enhance OTP verification flow with error handling and response checks
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m20s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m20s
This commit is contained in:
parent
25404b66f7
commit
0b2dcfcc01
@ -1,4 +1,6 @@
|
|||||||
import VerifyRegistrationOTPForm from "@/components/auth/verify-registration-otp-form";
|
import VerifyRegistrationOTPForm from "@/components/auth/verify-registration-otp-form";
|
||||||
|
import { checkIdOrPhone } from "@/queries/authentication";
|
||||||
|
import { tryCatch } from "@/utils/tryCatch";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
@ -16,7 +18,12 @@ export default async function VerifyRegistrationOTP({
|
|||||||
"phone number from server page params (verify otp page)",
|
"phone number from server page params (verify otp page)",
|
||||||
phone_number,
|
phone_number,
|
||||||
);
|
);
|
||||||
|
const [error, response] = await tryCatch(checkIdOrPhone({ phone_number }));
|
||||||
|
if (error) {
|
||||||
|
console.log("Error in checkIdOrPhone", error);
|
||||||
|
return redirect("/auth/signin");
|
||||||
|
}
|
||||||
|
if (response.verified || !response.verified) redirect("/auth/signin");
|
||||||
return (
|
return (
|
||||||
<div className="bg-gray-100 dark:bg-black w-full h-screen flex items-center justify-center font-sans">
|
<div className="bg-gray-100 dark:bg-black w-full h-screen flex items-center justify-center font-sans">
|
||||||
<div className="flex flex-col items-center justify-center w-full h-full ">
|
<div className="flex flex-col items-center justify-center w-full h-full ">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user