fix(auth): migrate from next-auth to better-auth (#1453)

This commit is contained in:
dancer 2026-03-13 23:18:01 +00:00 committed by GitHub
parent 453f5bb3e6
commit b4f595a68c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 668 additions and 390 deletions

View file

@ -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]);