@@ -8,4 +8,5 @@ setCookie("site-id-key", SITE_ID);
|
||||
export const client = Client.getInstance({
|
||||
baseURL: BASE_URL,
|
||||
siteId: SITE_ID,
|
||||
redirectOnUnauthorized: false,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useRef } from "react";
|
||||
import { useRef, type MouseEvent } from "react";
|
||||
import Autoplay from "embla-carousel-autoplay";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { ENDPOINT } from "../../config";
|
||||
@@ -80,6 +80,11 @@ export function Footer() {
|
||||
|
||||
const plugin = useRef(Autoplay({ delay: 2000, stopOnInteraction: true }));
|
||||
|
||||
const handlePopupLinkClick = (event: MouseEvent<HTMLAnchorElement>) => {
|
||||
event.preventDefault();
|
||||
window.open(event.currentTarget.href, "_blank", "width=940,height=800");
|
||||
};
|
||||
|
||||
return (
|
||||
<footer className="flex w-full shrink-0 flex-col items-start border-t border-solid border-border bg-background px-3 pb-1 pt-4 text-foreground sm:flex-row sm:px-6">
|
||||
<div className="mb-4 w-full sm:mb-0 sm:w-[55%]">
|
||||
@@ -98,12 +103,32 @@ export function Footer() {
|
||||
</div>
|
||||
<div className="flex w-full flex-col sm:w-[45%]">
|
||||
<div className="mb-4 flex flex-wrap justify-start gap-2 sm:mb-0 sm:justify-end sm:gap-4">
|
||||
<span className="text-sm sm:text-base md:text-xl">
|
||||
<a
|
||||
href="https://www.keco.or.kr/web/lay1/S1T6C1348/contents.do"
|
||||
onClick={handlePopupLinkClick}
|
||||
rel="noopener noreferrer"
|
||||
className="text-sm sm:text-base md:text-xl"
|
||||
>
|
||||
개인정보처리방침
|
||||
</span>
|
||||
<span className="text-sm sm:text-base md:text-xl">이용약관</span>
|
||||
<span className="text-sm sm:text-base md:text-xl">사이트맵</span>
|
||||
<span className="text-sm sm:text-base md:text-xl">고객센터</span>
|
||||
</a>
|
||||
<a
|
||||
href="https://www.keco.or.kr/web/lay1/S1T245C246/contents.do"
|
||||
onClick={handlePopupLinkClick}
|
||||
rel="noopener noreferrer"
|
||||
className="text-sm sm:text-base md:text-xl"
|
||||
>공공데이터 이용정책</a>
|
||||
<a
|
||||
href="https://www.keco.or.kr/web/lay1/S1T6C1349/contents.do"
|
||||
onClick={handlePopupLinkClick}
|
||||
rel="noopener noreferrer"
|
||||
className="text-sm sm:text-base md:text-xl"
|
||||
>저작권 정책</a>
|
||||
<a
|
||||
href="/cms/bbsnormal/9"
|
||||
target="_self"
|
||||
rel="noopener noreferrer"
|
||||
className="text-sm sm:text-base md:text-xl"
|
||||
>지원센타</a>
|
||||
</div>
|
||||
<div className="hidden sm:block">
|
||||
<Carousel
|
||||
|
||||
@@ -7,6 +7,7 @@ import { errorInterceptor } from "./error-interceptor";
|
||||
interface ClientConfig {
|
||||
baseURL: string;
|
||||
siteId: string;
|
||||
redirectOnUnauthorized?: boolean;
|
||||
}
|
||||
|
||||
const DEVICE_ID_KEY = "x-device-id";
|
||||
@@ -43,7 +44,10 @@ class Client {
|
||||
|
||||
this.axiosInstance.interceptors.response.use(
|
||||
(response) => response,
|
||||
(error) => errorInterceptor(error),
|
||||
(error) =>
|
||||
errorInterceptor(error, {
|
||||
redirectOnUnauthorized: config.redirectOnUnauthorized,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,15 @@ function redirectToLogin(): void {
|
||||
window.location.assign(loginUrl);
|
||||
}
|
||||
|
||||
export function errorInterceptor(error: unknown) {
|
||||
if (shouldRedirectToLogin(error)) redirectToLogin();
|
||||
export function errorInterceptor(
|
||||
error: unknown,
|
||||
options: { redirectOnUnauthorized?: boolean } = {},
|
||||
) {
|
||||
if (
|
||||
options.redirectOnUnauthorized !== false &&
|
||||
shouldRedirectToLogin(error)
|
||||
) {
|
||||
redirectToLogin();
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user