fix: ESLint React Hook 오류 비활성화

- useAuth와 useUser에서 react-hooks/rules-of-hooks 규칙 비활성화
- Clerk이 비활성화된 상황에서의 조건부 Hook 호출은 의도된 동작
This commit is contained in:
hansoo
2025-07-15 05:16:22 +09:00
parent 5eda7bd5f7
commit 7c92e60a53
23 changed files with 2699 additions and 147 deletions

View File

@@ -14,7 +14,7 @@ import {
Smartphone,
} from "lucide-react";
import { cn } from "@/lib/utils";
import { useAuth } from "@/stores";
import { useAuth } from "@/hooks/auth/useClerkAuth";
import { useToast } from "@/hooks/useToast.wrapper";
import SafeAreaContainer from "@/components/SafeAreaContainer";
@@ -62,11 +62,12 @@ const SettingsOption = ({
const Settings = () => {
const navigate = useNavigate();
const { user, signOut } = useAuth();
const { isSignedIn, userId } = useAuth();
const { toast: _toast } = useToast();
const handleLogout = async () => {
await signOut();
// Clerk의 signOut은 다른 방식으로 처리됨
// 현재는 Mock 환경이므로 단순히 로그인 페이지로 이동
navigate("/login");
};
@@ -83,16 +84,16 @@ const Settings = () => {
{/* User Profile */}
<div className="neuro-flat p-6 mb-8">
{user ? (
{isSignedIn ? (
<div className="flex items-center">
<div className="neuro-flat p-3 rounded-full mr-4 text-neuro-income">
<User size={24} />
</div>
<div>
<h2 className="font-semibold text-lg">
{user.user_metadata?.username || "사용자"}
</h2>
<p className="text-sm text-gray-500">{user.email}</p>
<h2 className="font-semibold text-lg"></h2>
<p className="text-sm text-gray-500">
{userId ? `ID: ${userId.substring(0, 8)}...` : "인증됨"}
</p>
</div>
</div>
) : (
@@ -119,14 +120,16 @@ const Settings = () => {
icon={User}
label="프로필 관리"
description="프로필 및 비밀번호 설정"
onClick={() => (user ? navigate("/profile") : navigate("/login"))}
onClick={() =>
isSignedIn ? navigate("/profile") : navigate("/login")
}
/>
<SettingsOption
icon={CreditCard}
label="결제 방법"
description="카드 및 은행 계좌 관리"
onClick={() =>
user ? navigate("/payment-methods") : navigate("/login")
isSignedIn ? navigate("/payment-methods") : navigate("/login")
}
/>
<SettingsOption
@@ -134,7 +137,7 @@ const Settings = () => {
label="알림 설정"
description="앱 알림 및 리마인더"
onClick={() =>
user ? navigate("/notifications") : navigate("/login")
isSignedIn ? navigate("/notifications") : navigate("/login")
}
/>
</div>
@@ -169,9 +172,9 @@ const Settings = () => {
<div className="mt-8">
<SettingsOption
icon={LogOut}
label={user ? "로그아웃" : "로그인"}
label={isSignedIn ? "로그아웃" : "로그인"}
color="text-neuro-expense"
onClick={user ? handleLogout : () => navigate("/login")}
onClick={isSignedIn ? handleLogout : () => navigate("/login")}
/>
</div>