From dbdc1df7d521f95e135746823437ae5651a503c5 Mon Sep 17 00:00:00 2001 From: i701 Date: Sat, 5 Apr 2025 11:50:39 +0500 Subject: [PATCH] refactor: update authentication flow to use PIN instead of email/password, enhance OTP verification with NextAuth, and improve session handling in components --- app/(dashboard)/devices/page.tsx | 1 + app/auth.ts | 18 ++++--- components/auth/signup-form.tsx | 74 ++++++++++++++++------------- components/auth/verify-otp-form.tsx | 29 ++++++----- middleware.ts | 2 +- 5 files changed, 67 insertions(+), 57 deletions(-) diff --git a/app/(dashboard)/devices/page.tsx b/app/(dashboard)/devices/page.tsx index 97500c8..25878cb 100644 --- a/app/(dashboard)/devices/page.tsx +++ b/app/(dashboard)/devices/page.tsx @@ -23,6 +23,7 @@ export default async function Devices({

My Devices

+
{JSON.stringify(session, null, 2)}
>({ queryKey: ["ATOLLS"], - queryFn: () => - getAtolls(), + queryFn: () => getAtolls(), placeholderData: keepPreviousData, staleTime: 1, }); @@ -38,29 +36,28 @@ export default function SignUpForm() { message: "", }); - React.useEffect(() => { - console.log(atoll) + console.log(atoll); }, [atoll]); - const params = useSearchParams(); const phoneNumberFromUrl = params.get("phone_number"); const NUMBER_WITHOUT_DASH = phoneNumberFromUrl?.split("-").join(""); - if (actionState?.db_error === "invalidPersonValidation") { return ( <> -
{actionState.message}
+
+ {actionState.message} +
- Go to {" "} + Go to{" "} login
- ) + ); } return (
@@ -126,8 +126,10 @@ export default function SignUpForm() { + defaultChecked={ + ((actionState?.payload?.get("terms") || "") as string) === "on" + } + name="terms" + id="terms" + />