쿠키 삭제제
This commit is contained in:
@@ -5,7 +5,7 @@ import { useQuery } from "@tanstack/react-query";
|
||||
import { images } from "@common/assets";
|
||||
import { getConfig } from "@common/config";
|
||||
import { ENDPOINT } from "../../config";
|
||||
import { setCookie, getCookie } from "../../lib";
|
||||
import { setCookie, getCookie, removeCookie } from "../../lib";
|
||||
import {
|
||||
getPopupInfo,
|
||||
getUserPopupList,
|
||||
@@ -70,6 +70,24 @@ export function Header({ viewOnly }: { viewOnly?: boolean }) {
|
||||
method: "POST",
|
||||
});
|
||||
if (!response.ok) throw new Error("Failed to logout");
|
||||
|
||||
// 쿠키 삭제
|
||||
if (appConfig.AUTH_USER_ID) {
|
||||
removeCookie(appConfig.AUTH_USER_ID);
|
||||
}
|
||||
if (appConfig.REFRESH_TOKEN) {
|
||||
removeCookie(appConfig.REFRESH_TOKEN);
|
||||
}
|
||||
if (appConfig.ACCESS_TOKEN) {
|
||||
removeCookie(appConfig.ACCESS_TOKEN);
|
||||
}
|
||||
if (appConfig.CLAIM_NAME) {
|
||||
removeCookie(appConfig.CLAIM_NAME);
|
||||
}
|
||||
|
||||
removeCookie("site-id-key");
|
||||
removeCookie("site-theme-key");
|
||||
|
||||
window.location.href = "/auth/login";
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
Reference in New Issue
Block a user