refactor: streamline authentication flow by removing unused code, replacing custom auth utilities with NextAuth, and updating session handling in components
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 5m56s

This commit is contained in:
2025-03-28 22:24:45 +05:00
parent 99c5fef748
commit ef9f032366
10 changed files with 291 additions and 323 deletions

View File

@ -3,7 +3,6 @@
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { authClient } from "@/lib/auth-client";
import { zodResolver } from "@hookform/resolvers/zod";
import { Loader2 } from "lucide-react";
import Link from "next/link";
@ -37,16 +36,16 @@ export default function VerifyOTPForm({
const onSubmit: SubmitHandler<z.infer<typeof OTPSchema>> = (data) => {
startTransition(async () => {
const isVerified = await authClient.phoneNumber.verify({
phoneNumber: phone_number,
code: data.pin,
});
console.log({ isVerified });
if (!isVerified.error) {
router.push("/devices");
} else {
toast.error(isVerified.error.message);
}
// const isVerified = await authClient.phoneNumber.verify({
// phoneNumber: phone_number,
// code: data.pin,
// });
// console.log({ isVerified });
// if (!isVerified.error) {
// router.push("/devices");
// } else {
// toast.error(isVerified.error.message);
// }
});
};
@ -70,11 +69,7 @@ export default function VerifyOTPForm({
<p className="text-red-500 text-sm">{errors.pin.message}</p>
)}
</div>
<Button
className="w-full"
disabled={isPending}
type="submit"
>
<Button className="w-full" disabled={isPending} type="submit">
{isPending ? <Loader2 className="animate-spin" /> : "Login"}
</Button>
</div>