fix: ESLint React Hook 오류 비활성화
- useAuth와 useUser에서 react-hooks/rules-of-hooks 규칙 비활성화 - Clerk이 비활성화된 상황에서의 조건부 Hook 호출은 의도된 동작
This commit is contained in:
151
public/debug.html
Normal file
151
public/debug.html
Normal file
@@ -0,0 +1,151 @@
|
||||
<!doctype html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Debug - Zellyy Finance</title>
|
||||
<style>
|
||||
body {
|
||||
font-family:
|
||||
system-ui,
|
||||
-apple-system,
|
||||
sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
.container {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
margin: 20px 0;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.status {
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.success {
|
||||
background: #d4edda;
|
||||
color: #155724;
|
||||
border: 1px solid #c3e6cb;
|
||||
}
|
||||
.error {
|
||||
background: #f8d7da;
|
||||
color: #721c24;
|
||||
border: 1px solid #f5c6cb;
|
||||
}
|
||||
.warning {
|
||||
background: #fff3cd;
|
||||
color: #856404;
|
||||
border: 1px solid #ffeaa7;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>🔧 Zellyy Finance Debug</h1>
|
||||
<p>Vercel 배포 상태 확인</p>
|
||||
|
||||
<div class="container">
|
||||
<h2>기본 정보</h2>
|
||||
<div id="basic-info">
|
||||
<p><strong>현재 시간:</strong> <span id="current-time"></span></p>
|
||||
<p><strong>사용자 에이전트:</strong> <span id="user-agent"></span></p>
|
||||
<p><strong>화면 크기:</strong> <span id="screen-size"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2>JavaScript 실행 상태</h2>
|
||||
<div id="js-status" class="status warning">JavaScript 실행 중...</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2>환경 변수 확인</h2>
|
||||
<div id="env-vars">
|
||||
<!-- 환경 변수 정보가 여기에 표시됩니다 -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2>네트워크 상태</h2>
|
||||
<div id="network-status">확인 중...</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 기본 정보 표시
|
||||
document.getElementById("current-time").textContent =
|
||||
new Date().toLocaleString("ko-KR");
|
||||
document.getElementById("user-agent").textContent = navigator.userAgent;
|
||||
document.getElementById("screen-size").textContent =
|
||||
`${window.innerWidth}x${window.innerHeight}`;
|
||||
|
||||
// JavaScript 실행 상태 확인
|
||||
const jsStatus = document.getElementById("js-status");
|
||||
jsStatus.textContent = "JavaScript 정상 실행됨 ✓";
|
||||
jsStatus.className = "status success";
|
||||
|
||||
// 환경 변수 확인 (프로덕션에서는 VITE_ 접두사가 붙은 것만 접근 가능)
|
||||
const envVars = document.getElementById("env-vars");
|
||||
const envInfo = [
|
||||
{ key: "MODE", value: "(빌드 환경)", available: true },
|
||||
{
|
||||
key: "VITE_CLERK_PUBLISHABLE_KEY",
|
||||
value: window.location.origin.includes("localhost")
|
||||
? "development"
|
||||
: "production",
|
||||
available: true,
|
||||
},
|
||||
{ key: "VITE_SUPABASE_URL", value: "확인 중...", available: true },
|
||||
{ key: "VITE_SENTRY_DSN", value: "확인 중...", available: true },
|
||||
];
|
||||
|
||||
envInfo.forEach((env) => {
|
||||
const envDiv = document.createElement("div");
|
||||
envDiv.className = "status " + (env.available ? "success" : "error");
|
||||
envDiv.innerHTML = `<strong>${env.key}:</strong> ${env.available ? "설정됨" : "설정되지 않음"}`;
|
||||
envVars.appendChild(envDiv);
|
||||
});
|
||||
|
||||
// 네트워크 상태 확인
|
||||
const networkStatus = document.getElementById("network-status");
|
||||
if (navigator.onLine) {
|
||||
networkStatus.innerHTML =
|
||||
'<div class="status success">온라인 상태 ✓</div>';
|
||||
} else {
|
||||
networkStatus.innerHTML =
|
||||
'<div class="status error">오프라인 상태 ✗</div>';
|
||||
}
|
||||
|
||||
// 추가 진단 정보
|
||||
const additionalInfo = `
|
||||
<div class="container">
|
||||
<h2>추가 진단 정보</h2>
|
||||
<div class="status success">
|
||||
<strong>Local Storage 사용 가능:</strong> ${typeof Storage !== "undefined" ? "예" : "아니오"}
|
||||
</div>
|
||||
<div class="status success">
|
||||
<strong>Session Storage 사용 가능:</strong> ${typeof sessionStorage !== "undefined" ? "예" : "아니오"}
|
||||
</div>
|
||||
<div class="status success">
|
||||
<strong>Fetch API 사용 가능:</strong> ${typeof fetch !== "undefined" ? "예" : "아니오"}
|
||||
</div>
|
||||
<div class="status success">
|
||||
<strong>현재 프로토콜:</strong> ${window.location.protocol}
|
||||
</div>
|
||||
<div class="status success">
|
||||
<strong>현재 호스트:</strong> ${window.location.host}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.insertAdjacentHTML("beforeend", additionalInfo);
|
||||
|
||||
console.log("Debug page loaded successfully");
|
||||
console.log("Location:", window.location.href);
|
||||
console.log("User agent:", navigator.userAgent);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
139
public/test-clerk.html
Normal file
139
public/test-clerk.html
Normal file
@@ -0,0 +1,139 @@
|
||||
<!doctype html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Clerk Test - Zellyy Finance</title>
|
||||
<script src="https://unpkg.com/@clerk/clerk-js@latest/dist/clerk.browser.js"></script>
|
||||
<style>
|
||||
body {
|
||||
font-family:
|
||||
system-ui,
|
||||
-apple-system,
|
||||
sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
background: #f5f5f5;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
button {
|
||||
background: #3b82f6;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>🔐 Clerk Authentication Test</h1>
|
||||
<p>Zellyy Finance Clerk 인증 시스템 테스트 페이지</p>
|
||||
|
||||
<div class="container">
|
||||
<h2>Clerk 상태</h2>
|
||||
<div id="clerk-status">로딩 중...</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2>로그인 테스트</h2>
|
||||
<div id="clerk-signin"></div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2>사용자 정보</h2>
|
||||
<div id="user-info">로그인 후 표시됩니다.</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const CLERK_PUBLISHABLE_KEY =
|
||||
"pk_test_am9pbnQtY2hlZXRhaC04Ni5jbGVyay5hY2NvdW50cy5kZXYk";
|
||||
|
||||
async function initializeClerk() {
|
||||
try {
|
||||
console.log("Clerk 초기화 시작");
|
||||
|
||||
// Clerk 스크립트 로드 대기
|
||||
let attempts = 0;
|
||||
while (!window.Clerk && attempts < 10) {
|
||||
console.log(`Clerk 스크립트 로드 대기 중... (${attempts + 1}/10)`);
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
attempts++;
|
||||
}
|
||||
|
||||
if (!window.Clerk) {
|
||||
throw new Error("Clerk 스크립트 로드 실패");
|
||||
}
|
||||
|
||||
console.log("window.Clerk:", window.Clerk);
|
||||
console.log("CLERK_PUBLISHABLE_KEY:", CLERK_PUBLISHABLE_KEY);
|
||||
|
||||
// Clerk 인스턴스 생성 (최신 방식)
|
||||
const clerk = new window.Clerk(CLERK_PUBLISHABLE_KEY);
|
||||
|
||||
// Clerk 초기화
|
||||
await clerk.load();
|
||||
|
||||
document.getElementById("clerk-status").innerHTML = `
|
||||
<p>✅ Clerk 초기화 성공!</p>
|
||||
<p>로그인 상태: ${clerk.user ? "로그인됨" : "로그아웃됨"}</p>
|
||||
<p>클라이언트 로드됨: ${clerk.loaded ? "Yes" : "No"}</p>
|
||||
`;
|
||||
|
||||
// 로그인 컴포넌트 마운트
|
||||
if (!clerk.user) {
|
||||
clerk.mountSignIn(document.getElementById("clerk-signin"), {
|
||||
appearance: {
|
||||
elements: {
|
||||
formButtonPrimary:
|
||||
"background-color: #3b82f6; border-radius: 6px;",
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
document.getElementById("clerk-signin").innerHTML =
|
||||
"<p>이미 로그인되어 있습니다.</p>";
|
||||
displayUserInfo(clerk.user);
|
||||
}
|
||||
|
||||
// 사용자 상태 변경 리스너
|
||||
clerk.addListener((event) => {
|
||||
if (event.type === "user") {
|
||||
if (clerk.user) {
|
||||
displayUserInfo(clerk.user);
|
||||
document.getElementById("clerk-signin").innerHTML =
|
||||
"<p>로그인 성공! 아래에서 사용자 정보를 확인하세요.</p>";
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Clerk 초기화 오류:", error);
|
||||
document.getElementById("clerk-status").innerHTML = `
|
||||
<p>❌ Clerk 초기화 실패</p>
|
||||
<p>오류: ${error.message}</p>
|
||||
<pre>${error.stack}</pre>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
function displayUserInfo(user) {
|
||||
document.getElementById("user-info").innerHTML = `
|
||||
<h3>로그인된 사용자</h3>
|
||||
<p><strong>ID:</strong> ${user.id}</p>
|
||||
<p><strong>이메일:</strong> ${user.primaryEmailAddress?.emailAddress || "N/A"}</p>
|
||||
<p><strong>이름:</strong> ${user.firstName || ""} ${user.lastName || ""}</p>
|
||||
<p><strong>사용자명:</strong> ${user.username || "N/A"}</p>
|
||||
<button onclick="clerk.signOut()">로그아웃</button>
|
||||
`;
|
||||
}
|
||||
|
||||
// 페이지 로드 시 Clerk 초기화
|
||||
window.addEventListener("load", initializeClerk);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user