fix(auth): migrate from next-auth to better-auth (#1453)
This commit is contained in:
parent
453f5bb3e6
commit
b4f595a68c
40 changed files with 668 additions and 390 deletions
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useActionState, useEffect, useState } from "react";
|
||||
|
||||
import { AuthForm } from "@/components/auth-form";
|
||||
import { SubmitButton } from "@/components/submit-button";
|
||||
import { toast } from "@/components/toast";
|
||||
import { useSession } from "@/lib/client";
|
||||
import { type LoginActionState, login } from "../actions";
|
||||
|
||||
export default function Page() {
|
||||
|
|
@ -23,9 +23,9 @@ export default function Page() {
|
|||
}
|
||||
);
|
||||
|
||||
const { update: updateSession } = useSession();
|
||||
const { refetch } = useSession();
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: router and updateSession are stable refs
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: router and refetch are stable refs
|
||||
useEffect(() => {
|
||||
if (state.status === "failed") {
|
||||
toast({
|
||||
|
|
@ -39,7 +39,7 @@ export default function Page() {
|
|||
});
|
||||
} else if (state.status === "success") {
|
||||
setIsSuccessful(true);
|
||||
updateSession();
|
||||
refetch();
|
||||
router.refresh();
|
||||
}
|
||||
}, [state.status]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue