Merge pull request #974 from LikiosSedo/fix/remove-authtype-useeffect

fix: remove unnecessary useEffect + useState for AUTH_TYPE constant
This commit is contained in:
Rohan Verma 2026-03-25 12:55:46 -07:00 committed by GitHub
commit a913e616e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,7 +5,7 @@ import { AnimatePresence, motion } from "motion/react";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { useEffect, useState } from "react"; import { useState } from "react";
import { loginMutationAtom } from "@/atoms/auth/auth-mutation.atoms"; import { loginMutationAtom } from "@/atoms/auth/auth-mutation.atoms";
import { Spinner } from "@/components/ui/spinner"; import { Spinner } from "@/components/ui/spinner";
import { getAuthErrorDetails, isNetworkError } from "@/lib/auth-errors"; import { getAuthErrorDetails, isNetworkError } from "@/lib/auth-errors";
@ -25,15 +25,10 @@ export function LocalLoginForm() {
title: null, title: null,
message: null, message: null,
}); });
const [authType, setAuthType] = useState<string | null>(null); const authType = AUTH_TYPE;
const router = useRouter(); const router = useRouter();
const [{ mutateAsync: login, isPending: isLoggingIn }] = useAtom(loginMutationAtom); const [{ mutateAsync: login, isPending: isLoggingIn }] = useAtom(loginMutationAtom);
useEffect(() => {
// Get the auth type from centralized config
setAuthType(AUTH_TYPE);
}, []);
const handleSubmit = async (e: React.FormEvent) => { const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault(); e.preventDefault();
setError({ title: null, message: null }); // Clear any previous errors setError({ title: null, message: null }); // Clear any previous errors