[cm] refactor: auth service 수정

This commit is contained in:
2026-07-16 18:21:37 +09:00
parent ebfba7ac8c
commit 10d89279bc
6 changed files with 54 additions and 22 deletions
@@ -18,10 +18,9 @@ import { getRemainingMs } from "@common/auth";
import { isAtLoginRedirectUrl } from "@common/network";
import { authService } from "../api/auth-service";
import { getToken, setupRefreshTimer } from "./token-manager";
const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
export function AuthWrapper({ children }: { children: React.ReactNode }) {
const router = useRouter();
const userInfo = useUserStore((state) => state.userInfo);
const setUserInfo = useUserStore((state) => state.setUserInfo);
@@ -31,9 +30,6 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
if (token) {
const remainingMs = getRemainingMs(token);
if (remainingMs > 0) {
console.log(
`[AuthWrapper] Refresh timer set: ${remainingMs}ms (${remainingMs / 1000}s)`,
);
setupRefreshTimer(authService.silentRefresh, remainingMs);
}
}
@@ -79,6 +75,4 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
}, []);
return <>{children}</>;
};
export { AuthWrapper };
}
@@ -0,0 +1,20 @@
import { v4 as uuidv4 } from "uuid";
const DEVICE_ID_KEY = "x-device-id";
export function getOrCreateDeviceId(): string {
if (typeof window === "undefined") return "";
const existing = localStorage.getItem(DEVICE_ID_KEY);
if (existing) return existing;
const id = uuidv4();
localStorage.setItem(DEVICE_ID_KEY, id);
return id;
}
export function clearDeviceId(): void {
if (typeof window === "undefined") return;
localStorage.removeItem(DEVICE_ID_KEY);
}
@@ -882,11 +882,6 @@ function UserSignupModal({ open, onClose, onSuccess }: UserSignupModalProps) {
type="submit"
className="user-signup-submit-button"
disabled={isLoading}
onClick={(e) => {
e.preventDefault();
console.log("회원가입 버튼 클릭됨 - onClick");
handleSubmit(e);
}}
>
{isLoading ? "가입 중..." : "회원가입"}
</button>
+1
View File
@@ -1,2 +1,3 @@
export * from "./api";
export * from "./auth";
export * from "./env";