fix: handle auth callback failures

This commit is contained in:
2569718930@qq.com
2026-06-05 16:50:52 +08:00
parent e6a1d14b09
commit 09979f3bb5
6 changed files with 105 additions and 4 deletions
+7 -2
View File
@@ -26,17 +26,18 @@ type Mode = "login" | "signup";
type LoginClientProps = {
nextPath: string;
initialError?: string;
initialMode?: Mode;
};
export function LoginClient({ nextPath, initialMode }: LoginClientProps) {
export function LoginClient({ nextPath, initialError, initialMode }: LoginClientProps) {
const router = useRouter();
const { locale } = useI18n();
const [mode, setMode] = useState<Mode>(initialMode ?? "login");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [loading, setLoading] = useState(false);
const [errorText, setErrorText] = useState("");
const [errorText, setErrorText] = useState(initialError || "");
const [infoText, setInfoText] = useState("");
const [resetSent, setResetSent] = useState(false);
const [showPassword, setShowPassword] = useState(false);
@@ -121,6 +122,10 @@ export function LoginClient({ nextPath, initialMode }: LoginClientProps) {
/>
);
useEffect(() => {
setErrorText(initialError || "");
}, [initialError]);
const onResetPassword = async () => {
setErrorText("");
setInfoText("");