feat: rewrite 시 정적 자산 경로 셋팅

This commit is contained in:
2025-04-29 17:15:27 +09:00
parent 6ba562a1b4
commit 983d67983e
4 changed files with 37 additions and 19 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "cs",
"name": "features",
"version": "0.0.0",
"private": true,
"scripts": {
@@ -1,8 +1,14 @@
"use client";
import { PostApi, type Post, type PostParams } from "@/entities/post";
import { ENDPOINT } from "@/shared/config";
import { PageLayout } from "@/shared/ui/page-layout";
import { useEffect, useState } from "react";
import { useRouter } from "next/navigation";
import { useQuery } from "@tanstack/react-query";
import {
getCoreRowModel,
useReactTable,
type PaginationState,
type RowSelectionState,
} from "@tanstack/react-table";
import {
Button,
DataTable,
@@ -14,15 +20,9 @@ import {
SelectTrigger,
SelectValue,
} from "@common/components/ui";
import { useQuery } from "@tanstack/react-query";
import {
getCoreRowModel,
useReactTable,
type PaginationState,
type RowSelectionState,
} from "@tanstack/react-table";
import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { PostApi, type Post, type PostParams } from "@/entities/post";
import { ENDPOINT } from "@/shared/config";
import { PageLayout } from "@/shared/ui/page-layout";
import { columns } from "../model/notice-table-columns";
function NoticePage({ bbsId }: { bbsId: string }) {
@@ -30,9 +30,9 @@ function NoticePage({ bbsId }: { bbsId: string }) {
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
const [postParams, setPostParams] = useState<PostParams>({
keywordType: "",
keywordType: "title",
keyword: "",
delYn: "",
delYn: "N",
});
const [pagination, setPagination] = useState<PaginationState>({
pageIndex: 0,
+2 -1
View File
@@ -13,7 +13,8 @@ const nextConfig: NextConfig = {
has: [
{
type: "header",
key: "x-rewrite-me",
key: "referer",
value: "(.*)/pst(.*)",
},
],
},
+20 -3
View File
@@ -1,7 +1,8 @@
import dayjs from "dayjs";
import type { ColumnDef } from "@tanstack/react-table";
import { Button } from "@common/components/ui";
import { useRouter } from "next/navigation";
import type { ColumnDef, Row } from "@tanstack/react-table";
import type { Board } from "@/entities/board/model/board-interface";
import { Button } from "@common/components/ui";
export const columns: ColumnDef<Board>[] = [
{
@@ -36,6 +37,22 @@ export const columns: ColumnDef<Board>[] = [
{
id: "actions",
header: "관리",
cell: () => <Button size="sm">관리</Button>,
cell: ({ row }) => <ManageButton row={row} />,
},
];
const ManageButton = ({ row }: { row: Row<Board> }) => {
const router = useRouter();
const { bbsTypeCd, bbsId } = row.original;
return (
<Button
size="sm"
onClick={(e) => {
e.stopPropagation();
router.push(`/pst/${bbsTypeCd.toLowerCase()}/${bbsId}`);
}}
>
관리
</Button>
);
};