Merge branch 'iipbs/sn/dev' into iipbs/sn/dev_kic

This commit is contained in:
kiminchan
2026-07-24 15:12:08 +09:00
22 changed files with 181 additions and 154 deletions
+1 -12
View File
@@ -68,7 +68,7 @@ async function handler(
cookieStore.set(REFRESH_TOKEN, refreshToken, {
httpOnly: true,
sameSite: "strict",
domain: getCookieDomain(),
domain: COOKIE_DOMAIN,
path: "/",
});
}
@@ -92,14 +92,3 @@ export async function PUT(request: Request, props: { params: Promise<{ url: stri
const params = await props.params;
return handler(request, params, "PUT");
}
function getCookieDomain(): string | undefined {
if (typeof window === "undefined") return undefined;
if (COOKIE_DOMAIN) return COOKIE_DOMAIN;
const { hostname } = window.location;
if (hostname === "localhost" || hostname === "127.0.0.1") return undefined;
return hostname;
}
+1
View File
@@ -1,6 +1,7 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: "standalone",
reactStrictMode: true,
transpilePackages: ["@common/assets"],
};
+2
View File
@@ -2,6 +2,7 @@ import {
ACCESS_TOKEN,
AUTH_USER_ID,
CLAIM_NAME,
COOKIE_DOMAIN,
REFRESH_TOKEN,
SERVER_API_URL,
SITE_ID,
@@ -135,6 +136,7 @@ async function handler(
cookieStore.set(REFRESH_TOKEN, refreshToken, {
httpOnly: true,
sameSite: "lax",
domain: COOKIE_DOMAIN,
path: "/",
});
}
+1 -12
View File
@@ -70,7 +70,7 @@ async function handler(
response.cookies.set(REFRESH_TOKEN, refreshToken, {
httpOnly: true,
sameSite: "strict",
domain: getCookieDomain(),
domain: COOKIE_DOMAIN,
path: "/",
});
}
@@ -105,14 +105,3 @@ export async function PUT(
const params = await props.params;
return handler(request, params, "PUT");
}
function getCookieDomain(): string | undefined {
if (typeof window === "undefined") return undefined;
if (COOKIE_DOMAIN) return COOKIE_DOMAIN;
const { hostname } = window.location;
if (hostname === "localhost" || hostname === "127.0.0.1") return undefined;
return hostname;
}
+4 -4
View File
@@ -41,7 +41,7 @@ export function middleware(req: NextRequest) {
logMessages.push(` Rewritten URL: ${newUrl}`);
logMessages.push("\n--------------------------------\n");
// console.log(logMessages.join("\n"));
console.log(logMessages.join("\n"));
const response = NextResponse.rewrite(new URL(newUrl));
return addSecurityHeaders(response);
@@ -58,7 +58,7 @@ export function middleware(req: NextRequest) {
logMessages.push(` Rewritten URL: ${newUrl}`);
logMessages.push("\n--------------------------------\n");
// console.log(logMessages.join("\n"));
console.log(logMessages.join("\n"));
const response = NextResponse.rewrite(new URL(newUrl), {
headers: requestHeaders,
@@ -83,7 +83,7 @@ export function middleware(req: NextRequest) {
logMessages.push(` Link API Rewritten URL: ${newUrl}`);
logMessages.push("\n--------------------------------\n");
// console.log(logMessages.join("\n"));
console.log(logMessages.join("\n"));
const response = NextResponse.rewrite(new URL(newUrl), {
headers: requestHeaders,
@@ -97,7 +97,7 @@ export function middleware(req: NextRequest) {
}
logMessages.push("\n--------------------------------\n");
// console.log(logMessages.join("\n"));
console.log(logMessages.join("\n"));
const response = NextResponse.next();
return addSecurityHeaders(response);
+1 -1
View File
@@ -18,7 +18,7 @@ const nextConfig: NextConfig = {
fetches: {
fullUrl: true,
},
},
},
async headers() {
return [
{
+11 -2
View File
@@ -1,9 +1,10 @@
'use client'
import { NoFooterLayout } from "@common/components";
import { useQueryClient } from "@tanstack/react-query";
import type { MenuItem } from "../../store/common";
import { useFoStore } from "../../store";
import { usePathname, useRouter } from "next/navigation";
// import { authService } from "@/src/entities/auth";
import { authService } from "@/src/entities/auth";
export default function RootLayout({
children,
@@ -14,12 +15,20 @@ export default function RootLayout({
const { getMenuAuth } = useFoStore((state) => state);
const pathname = usePathname();
const router = useRouter();
const queryClient = useQueryClient();
const handleClick = (id: MenuItem) => {
getMenuAuth(id.menuCd);
router.push(id.urlPath);
};
return (
<NoFooterLayout currentPath={pathname ?? ""} handleMenuClick={handleClick}>{children}</NoFooterLayout>
<NoFooterLayout
queryClient={queryClient}
authService={authService}
currentPath={pathname ?? ""}
handleMenuClick={handleClick}
>
{children}
</NoFooterLayout>
);
}
+2
View File
@@ -20,6 +20,7 @@ import { NoFooterLayout } from "@common/components";
import type { MenuItem } from "@/entities/menu";
import { useMenuStore } from "@/shared/lib";
import useStore from '../store/useStore';
import { authService } from "@/entities/auth";
export default function MapLayout({
children,
@@ -57,6 +58,7 @@ export default function MapLayout({
return (
<NoFooterLayout
queryClient={queryClient}
authService={authService}
currentPath={pathname ?? ""}
handleMenuClick={handleMenuClick}
>
+2
View File
@@ -5,6 +5,7 @@ import {
ACCESS_TOKEN,
AUTH_USER_ID,
CLAIM_NAME,
COOKIE_DOMAIN,
REFRESH_TOKEN,
SERVER_API_URL,
SITE_ID,
@@ -75,6 +76,7 @@ async function handler(
cookieStore.set(REFRESH_TOKEN, refreshToken, {
httpOnly: true,
sameSite: "lax",
domain: COOKIE_DOMAIN,
path: "/",
});
}
+37 -37
View File
@@ -1,47 +1,47 @@
import type { NextConfig } from "next";
const subDomain =
process.env.NEXT_PUBLIC_SUB_DOMAIN || "http://localhost:13000";
process.env.NEXT_PUBLIC_SUB_DOMAIN || "http://localhost:13000";
const nextConfig: NextConfig = {
// output: "standalone",
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "Content-Security-Policy",
value: "img-src 'self' data: https: blob:;",
},
],
},
];
},
async rewrites() {
return {
beforeFiles: [
{
source: "/_next/static/:path*",
destination: `${subDomain}/_next/static/:path*`,
has: [
output: "standalone",
async headers() {
return [
{
type: "header",
key: "referer",
value: "(.*)/cms(.*)",
source: "/(.*)",
headers: [
{
key: "Content-Security-Policy",
value: "img-src 'self' data: https: blob:;",
},
],
},
],
},
],
afterFiles: [
{
source: "/cms/:path*",
destination: `${subDomain}/cms/:path*`,
},
],
fallback: [],
};
},
];
},
async rewrites() {
return {
beforeFiles: [
{
source: "/_next/static/:path*",
destination: `${subDomain}/_next/static/:path*`,
has: [
{
type: "header",
key: "referer",
value: "(.*)/cms(.*)",
},
],
},
],
afterFiles: [
{
source: "/cms/:path*",
destination: `${subDomain}/cms/:path*`,
},
],
fallback: [],
};
},
};
export default nextConfig;
@@ -84,7 +84,7 @@ export function ScheduleInfoPanel({ params }: ScheduleInfoPanelProps) {
<div className="space-y-2">
<div className="flex items-center justify-between rounded-sm border border-border p-3">
<Badge size="lg" className="font-semibold">
{data.inptSeCd}차 입력기간
입력기간
</Badge>
<p className="text-2xl">
{dayjs(data.inptBgngYmd).format(
@@ -102,7 +102,7 @@ export function ScheduleInfoPanel({ params }: ScheduleInfoPanelProps) {
color="gray"
className="font-semibold"
>
{data.vrfcSeCd}차 검증기간
검증기간
</Badge>
<p className="text-2xl">
{dayjs(data.vrfcBgngYmd).format(
+9 -1
View File
@@ -1,9 +1,11 @@
"use client";
import type { MenuItem } from "@common/components/api";
import { NoFooterLayout } from "@common/components/ui";
import { useQueryClient } from "@tanstack/react-query";
import { usePathname,useRouter } from "next/navigation";
import { useMenuStore } from "@/src/shared/lib";
import { useWrStore } from "../store";
import { authService } from "@/src/entities/auth";
export default function MapLayout({
children,
@@ -14,6 +16,7 @@ export default function MapLayout({
const setCurrentMenuInfo = useMenuStore((state) => state.setCurrentMenuInfo);
const router = useRouter();
const pathname = usePathname();
const queryClient = useQueryClient();
const changeMenu = (path: MenuItem) => {
setCurrentMenuInfo(path);
@@ -21,7 +24,12 @@ export default function MapLayout({
router.push(path.urlPath);
};
return (
<NoFooterLayout currentPath={pathname ?? ""} handleMenuClick={changeMenu}>
<NoFooterLayout
queryClient={queryClient}
authService={authService}
currentPath={pathname ?? ""}
handleMenuClick={changeMenu}
>
{children}
</NoFooterLayout>
);
+19 -23
View File
@@ -1,35 +1,31 @@
import { getApiClient } from "./client";
import { getConfig } from "@common/config";
import { ENDPOINT } from "../config";
import { getAuthHeaders } from "../lib/auth-header";
export interface Banner {
bnrSn: number;
bnrTypeCd: string;
bnrTypeNm: string;
bnrTtl: string;
lnkgUrlAddr: string;
useYn: string;
atflCd: string;
mdfcnDt: string;
mdfr: string;
mdfrNm: string;
}
bnrSn: number;
bnrTypeCd: string;
bnrTypeNm: string;
bnrTtl: string;
lnkgUrlAddr: string;
useYn: string;
atflCd: string;
mdfcnDt: string;
mdfr: string;
mdfrNm: string;
}
const { PROXY_HOST } = getConfig();
const BASE_URL = `${PROXY_HOST}/server`;
const { PROXY_HOST } = getConfig();
const BASE_URL = `${PROXY_HOST}/server`;
const client = getApiClient();
export const getBannerList = async (siteId: string) => {
const response = await client.get<Banner[]>(
export const getBannerList = async (siteId: string): Promise<Banner[]> => {
const response = await fetch(
`${BASE_URL}${ENDPOINT.CMS_SERVICE.BANNERS}/${siteId}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
headers: getAuthHeaders(),
credentials: "include",
},
);
return response.data;
return response.json();
};
+23 -13
View File
@@ -1,4 +1,4 @@
import { getApiClient } from "./client";
import { getAuthHeaders } from "../lib/auth-header";
import { ENDPOINT } from "../config";
import { getConfig } from "@common/config";
@@ -27,22 +27,33 @@ export interface TreeMenu extends MenuItem {
menuHlpCn: string;
}
const client = getApiClient();
const { PROXY_HOST } = getConfig();
const BASE_URL = `${PROXY_HOST}/server`;
export const getMenuList = async (siteId: string) => {
const response = await client.get<MenuItem[]>(
`${ENDPOINT.CMS_SERVICE.MENU_ROLES}/${siteId}`,
export const getMenuList = async (siteId: string): Promise<MenuItem[]> => {
const response = await fetch(
`${BASE_URL}${ENDPOINT.CMS_SERVICE.MENU_ROLES}/${siteId}`,
{
method: "GET",
headers: getAuthHeaders(),
credentials: "include",
},
);
return response.data;
return response.json();
};
export const getPreviewTreeMenuList = async (siteId: string) => {
const response = await client.get<TreeMenu[]>(
`${ENDPOINT.CMS_SERVICE.MENUS}/${siteId}/tree/preview`,
export const getPreviewTreeMenuList = async (
siteId: string,
): Promise<TreeMenu[]> => {
const response = await fetch(
`${BASE_URL}${ENDPOINT.CMS_SERVICE.MENUS}/${siteId}/tree/preview`,
{
method: "GET",
headers: getAuthHeaders(),
credentials: "include",
},
);
return response.data;
return response.json();
};
export const getAnonymouseMenuList = async (
@@ -52,9 +63,8 @@ export const getAnonymouseMenuList = async (
`${BASE_URL}${ENDPOINT.CMS_SERVICE.MENU_ANONYMOUS}/user/${siteId}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
headers: getAuthHeaders(),
credentials: "include",
},
);
return response.json();
+10 -17
View File
@@ -1,6 +1,6 @@
import { getApiClient } from "./client";
import { getConfig } from "@common/config";
import { ENDPOINT } from "../config";
import { getAuthHeaders } from "../lib/auth-header";
export interface SiteInfo {
siteId: string;
@@ -62,25 +62,18 @@ export const getSiteInfo = async (siteId: string) => {
`${BASE_URL}${ENDPOINT.CMS_SERVICE.SITES}/${siteId}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
headers: getAuthHeaders(),
credentials: "include",
},
);
return response.json() as Promise<SiteInfo>;
};
const client = getApiClient();
export const getSiteList = async () => {
const response = await client.get<SiteListResponse>(
`${BASE_URL}${ENDPOINT.CMS_SERVICE.SITE_LIST}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
},
);
return response.data;
export const getSiteList = async (): Promise<SiteListResponse> => {
const response = await fetch(`${BASE_URL}${ENDPOINT.CMS_SERVICE.SITE_LIST}`, {
method: "GET",
headers: getAuthHeaders(),
credentials: "include",
});
return response.json();
};
@@ -0,0 +1,22 @@
import Cookies from "js-cookie";
import { getConfig } from "@common/config";
export function getAuthHeaders(): HeadersInit {
const { CLAIM_NAME, AUTH_USER_ID } = getConfig();
if (!CLAIM_NAME || !AUTH_USER_ID) {
throw new Error("Required environment variables are not set");
}
const headers: Record<string, string> = {
"Content-Type": "application/json",
};
const token = Cookies.get(CLAIM_NAME);
const userId = Cookies.get(AUTH_USER_ID);
if (token) headers[CLAIM_NAME] = token;
if (userId) headers[AUTH_USER_ID] = userId;
return headers;
}
@@ -12,8 +12,6 @@ import {
CarouselPrevious,
} from "../carousel";
const siteId = getCookie("site-id-key") ?? "";
type BannerImageProps = {
atflCd: string;
bnrSn: number;
@@ -64,6 +62,8 @@ const BannerImage = ({ atflCd, lnkgUrlAddr }: BannerImageProps) => {
};
export function Footer() {
const siteId = getCookie("site-id-key") ?? "";
const { data: siteInfo } = useQuery({
queryKey: [ENDPOINT.CMS_SERVICE.SITES, siteId],
queryFn: () => getSiteInfo(siteId),
@@ -29,7 +29,6 @@ import { ScrollArea, ScrollBar } from "../scroll-area";
const appConfig = getConfig();
const userId = getCookie(appConfig.AUTH_USER_ID ?? "");
const siteId = getCookie("site-id-key") ?? "";
const isLoggedIn = !!userId;
function getRootDomain(hostname: string): string {
@@ -144,6 +143,7 @@ export function Header({
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
const logoRef = useRef<HTMLImageElement>(null);
const remainingMs = useTokenRemainingMs(mounted && isLoggedIn && !viewOnly);
const siteId = getCookie("site-id-key") ?? "";
useSessionExtendConfirm({
enabled:
@@ -8,15 +8,18 @@ import { SidebarProvider } from "../sidebar";
import { LNB } from "../lnb";
import { Header } from "../header";
import "./common.css";
import type { AuthService } from "@common/auth";
export function NoFooterLayout({
children,
queryClient,
authService,
currentPath,
handleMenuClick,
}: {
children: React.ReactNode;
queryClient?: QueryClient;
authService?: AuthService;
currentPath?: string;
handleMenuClick?: (item: MenuItem) => void;
}) {
@@ -26,19 +29,19 @@ export function NoFooterLayout({
<PopupProvider>
<HelpDialogProvider>
<SidebarProvider>
<div className="flex-1">
<Header />
<div className="flex">
<LNB
currentPath={currentPath}
handleMenuClick={handleMenuClick}
/>
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
<div className="flex-1">
<Header authService={authService} />
<div className="flex">
<LNB
currentPath={currentPath}
handleMenuClick={handleMenuClick}
/>
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
</div>
</div>
</div>
</div>
</SidebarProvider>
</SidebarProvider>
</HelpDialogProvider>
</PopupProvider>
</ClientIpGuard>
@@ -6,7 +6,6 @@ import { HelpDialogProvider } from "../../provider/help-dialog-context";
import { ClientIpGuard } from "../../lib/client-ip-guard";
import type { MenuItem } from "../../api";
import { SidebarProvider } from "../sidebar";
import { LNB } from "../lnb";
import { Header } from "../header";
import { Footer } from "../footer";
import "./common.css";
@@ -17,7 +16,6 @@ export function NoLNBLayout({
authService,
tokenManager,
currentPath,
handleMenuClick,
}: {
children: React.ReactNode;
queryClient?: QueryClient;
@@ -33,19 +31,19 @@ export function NoLNBLayout({
<PopupProvider>
<HelpDialogProvider>
<SidebarProvider>
<div className="flex-1">
<Header
authService={authService}
tokenManager={authService ? undefined : tokenManager}
/>
<div className="flex">
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
<Footer />
<div className="flex-1">
<Header
authService={authService}
tokenManager={authService ? undefined : tokenManager}
/>
<div className="flex">
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
<Footer />
</div>
</div>
</div>
</div>
</SidebarProvider>
</SidebarProvider>
</HelpDialogProvider>
</PopupProvider>
</ClientIpGuard>
@@ -42,7 +42,6 @@ import {
const appConfig = getConfig();
const userId = getCookie(appConfig.AUTH_USER_ID ?? "");
const appSiteId = getCookie("site-id-key") ?? "";
const isLoggedIn = !!userId;
export function LNB({
@@ -74,6 +73,7 @@ export function LNB({
helpContent,
} = useHelpDialog();
const appSiteId = getCookie("site-id-key") ?? "";
const siteId = propSiteId ?? appSiteId;
const { data: menuListData } = useQuery({
+5 -2
View File
@@ -247,9 +247,9 @@ importers:
'@common/components':
specifier: workspace:*
version: link:../../packages/common/components
'@common/config':
'@common/network':
specifier: workspace:*
version: link:../../packages/common/config
version: link:../../packages/common/network
'@dnd-kit/core':
specifier: ^6.3.1
version: 6.3.1(react-dom@19.2.4(react@19.2.4))(react@19.2.4)
@@ -1042,6 +1042,9 @@ importers:
js-cookie:
specifier: ^3.0.5
version: 3.0.5
lucide-react:
specifier: ^0.474.0
version: 0.474.0(react@19.2.4)
moment:
specifier: ^2.30.1
version: 2.30.1