대시보드 게시글 링크 수정정

This commit is contained in:
2026-01-21 17:52:22 +09:00
parent 80598a5b6a
commit 2469a84068
3 changed files with 16 additions and 32 deletions
+1 -23
View File
@@ -9,31 +9,9 @@ import {
export async function POST() { export async function POST() {
const cookieStore = await cookies(); const cookieStore = await cookies();
// 백엔드에 로그아웃 알림 (토큰 블랙리스트 처리)
const refreshToken = cookieStore.get(REFRESH_TOKEN)?.value;
if (refreshToken) {
try {
// ⭐ Spring Boot 백엔드에 로그아웃 요청
await fetch(`${process.env.NEXT_PUBLIC_SERVER_API_URL}/api/auth/logout`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Cookie": `${REFRESH_TOKEN}=${refreshToken}`,
},
// credentials: "include", // fetch에서는 직접 쿠키 전달
});
} catch (error) {
console.error("Backend logout failed:", error);
}
}
// Next.js 쿠키 삭제
cookieStore.delete(ACCESS_TOKEN); cookieStore.delete(ACCESS_TOKEN);
cookieStore.delete(REFRESH_TOKEN); cookieStore.delete(REFRESH_TOKEN);
cookieStore.delete(AUTH_USER_ID); cookieStore.delete(AUTH_USER_ID);
cookieStore.delete(CLAIM_NAME); cookieStore.delete(CLAIM_NAME);
return NextResponse.json({ message: "Logged out" }, { status: 200 }); return NextResponse.json({ message: "Logged out" }, { status: 200 });
} }
+10 -4
View File
@@ -3,7 +3,7 @@
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { getCoreRowModel } from "@tanstack/react-table"; import { getCoreRowModel } from "@tanstack/react-table";
import { PostApi, type MyPost } from "@/entities/post"; import { PostApi, type MyPost, type NoticePost } from "@/entities/post";
import { ENDPOINT } from "@/shared/config"; import { ENDPOINT } from "@/shared/config";
import { useDataTable } from "@/shared/lib"; import { useDataTable } from "@/shared/lib";
import { import {
@@ -23,15 +23,21 @@ const MyPostList: React.FC = () => {
}), }),
}); });
const handleMyPostRowClick = (row: MyPost) => {
router.push(`/cms/${row.bbsTypeCd.toLowerCase()}/${row.bbsId}/${row.pstNo}`);
};
const { tableComponent: myPostTableComponent } = useDataTable({ const { tableComponent: myPostTableComponent } = useDataTable({
query: myPostQuery, query: myPostQuery,
tableOptions: { tableOptions: {
columns: myPostTableColumns, columns: myPostTableColumns,
getCoreRowModel: getCoreRowModel(), getCoreRowModel: getCoreRowModel(),
}, },
dataTableOptions: { dataTableOptions: {
variant: "line", variant: "line",
onRowClick: handleMyPostRowClick
}, },
}); });
return ( return (
@@ -26,7 +26,7 @@ const NoticeList: React.FC = () => {
}); });
const handleNoticePostRowClick = (row: NoticePost) => { const handleNoticePostRowClick = (row: NoticePost) => {
router.push(`/bbs/bbsnotice/${row.bbsId}/${row.pstNo}`); router.push(`/cms/${row.bbsTypeCd.toLowerCase()}/${row.bbsId}/${row.pstNo}`);
}; };
const handleMoreClick = () => { const handleMoreClick = () => {
@@ -40,12 +40,12 @@ const NoticeList: React.FC = () => {
const { tableComponent: noticePostTableComponent } = useDataTable({ const { tableComponent: noticePostTableComponent } = useDataTable({
query: noticePostQuery, query: noticePostQuery,
tableOptions: { tableOptions: {
columns: noticePostTableColumns, columns: noticePostTableColumns,
getCoreRowModel: getCoreRowModel(), getCoreRowModel: getCoreRowModel(),
}, },
dataTableOptions: { dataTableOptions: {
variant: "line", variant: "line",
onRowClick: handleNoticePostRowClick, onRowClick: handleNoticePostRowClick,
}, },
}); });