mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-02 03:38:22 +00:00
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
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 5m56s
This commit is contained in:
@ -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>
|
||||
|
Reference in New Issue
Block a user