[cs] chore: auth service 수정
This commit is contained in:
@@ -8,10 +8,10 @@ import {
|
||||
import { getRemainingMs } from "@common/auth";
|
||||
|
||||
import {
|
||||
clearAuthToken,
|
||||
removeToken,
|
||||
setToken,
|
||||
setupRefreshTimer,
|
||||
tokenManager,
|
||||
} from "../lib/token-manager";
|
||||
import type { AuthPayload, AuthService } from "../model/auth-interface";
|
||||
|
||||
@@ -92,7 +92,7 @@ async function silentRefresh(): Promise<void> {
|
||||
`[silentRefresh] Failed at ${new Date().toISOString()}`,
|
||||
error,
|
||||
);
|
||||
clearAuthToken();
|
||||
tokenManager.clearAuthToken();
|
||||
if (typeof window !== "undefined") {
|
||||
window.dispatchEvent(new CustomEvent("auth:logout"));
|
||||
}
|
||||
@@ -110,7 +110,7 @@ async function logout(): Promise<void> {
|
||||
console.error("Logout API failed:", error);
|
||||
}
|
||||
|
||||
clearAuthToken();
|
||||
tokenManager.clearAuthToken();
|
||||
removeToken("site-id-key");
|
||||
removeToken("site-theme-key");
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createTokenManager } from "@common/auth";
|
||||
import { authConfig } from "@/shared/config/auth";
|
||||
import { createTokenManager } from "@common/auth";
|
||||
|
||||
export const tokenManager = createTokenManager(authConfig);
|
||||
|
||||
@@ -8,7 +8,6 @@ export const {
|
||||
setToken,
|
||||
removeToken,
|
||||
setupRefreshTimer,
|
||||
clearAuthToken,
|
||||
getAccessToken,
|
||||
getRefreshToken,
|
||||
getUserId,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { AuthConfig } from "@common/auth";
|
||||
|
||||
import {
|
||||
ACCESS_TOKEN,
|
||||
AUTH_USER_ID,
|
||||
|
||||
Reference in New Issue
Block a user