feat: 동영상 게시글 수정
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import dayjs from "dayjs";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import type { ColumnDef, Row } from "@tanstack/react-table";
|
||||
@@ -45,7 +46,6 @@ export const columns: ColumnDef<Board>[] = [
|
||||
|
||||
const ManageButton = ({ row }: { row: Row<Board> }) => {
|
||||
const router = useRouter();
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const pathname = usePathname();
|
||||
const [, setBbsInfo] = useLocalStorage("bbs-info", "");
|
||||
const { setBbsInfo: setStoreBbsInfo } = useMenuStore((state) => state);
|
||||
@@ -56,8 +56,8 @@ const ManageButton = ({ row }: { row: Row<Board> }) => {
|
||||
size="sm"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
// router.push(`${pathname}/${bbsTypeCd.toLowerCase()}/${bbsId}`);
|
||||
router.push(`/pst/${bbsTypeCd.toLowerCase()}/${bbsId}`);
|
||||
router.push(`${pathname}/${bbsTypeCd.toLowerCase()}/${bbsId}`);
|
||||
// router.push(`/pst/${bbsTypeCd.toLowerCase()}/${bbsId}`); // 공통 개발용
|
||||
setBbsInfo(JSON.stringify(row.original));
|
||||
setStoreBbsInfo(row.original);
|
||||
}}
|
||||
|
||||
@@ -31,7 +31,8 @@ export const createColumns = (
|
||||
/>
|
||||
),
|
||||
cell: ({ row, table }) => {
|
||||
const { atflCd, pstNo, pstTtl, inqNocs, rgtrNm, regDt } = row.original;
|
||||
const { atflCd, pstNo, pstTtl, pstCn, inqNocs, rgtrNm, regDt } =
|
||||
row.original;
|
||||
const bbsTypeCd = table.options.meta?.bbsTypeCd;
|
||||
|
||||
if (bbsTypeCd === "BBSIMAGE") {
|
||||
@@ -99,6 +100,9 @@ export const createColumns = (
|
||||
{pstTtl}
|
||||
</span>
|
||||
</div>
|
||||
<p className="line-clamp-3 overflow-hidden text-[1.2rem] text-label">
|
||||
{pstCn}
|
||||
</p>
|
||||
<div className="flex flex-col">
|
||||
<span className="text-[1.4rem] font-bold text-label">
|
||||
{rgtrNm}
|
||||
@@ -135,7 +139,7 @@ const ThumbImage = ({
|
||||
}: ThumbImageProps) => {
|
||||
const prevImage = thumbRefs.current.get(pstNo);
|
||||
|
||||
const { data: imageUrl, isLoading } = useQuery({
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: [ENDPOINT.ATTACH_SERVICE.IMAGES, atflCd],
|
||||
queryFn: () => {
|
||||
if (bbsTypeCd === "BBSIMAGE") {
|
||||
@@ -151,6 +155,8 @@ const ThumbImage = ({
|
||||
enabled: !prevImage && !!atflCd,
|
||||
});
|
||||
|
||||
const imageUrl = prevImage ?? data;
|
||||
|
||||
if (isLoading)
|
||||
return (
|
||||
<div className="h-[16rem] w-full">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useRef, useState } from "react";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
@@ -67,14 +67,15 @@ function PostPage({ bbsId }: { bbsId: string }) {
|
||||
isFetched,
|
||||
refetch,
|
||||
} = useQuery({
|
||||
queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, bbsId],
|
||||
queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, bbsInfo?.bbsTypeCd],
|
||||
queryFn: () =>
|
||||
PostApi.getPostList(parseInt(bbsId), {
|
||||
...postParams,
|
||||
bbsTypeCd: bbsInfo?.bbsTypeCd,
|
||||
page: pagination.pageIndex,
|
||||
size: pagination.pageSize,
|
||||
}),
|
||||
enabled: false,
|
||||
enabled: !!bbsInfo?.bbsTypeCd,
|
||||
});
|
||||
|
||||
const isGridViewPage =
|
||||
@@ -123,10 +124,6 @@ function PostPage({ bbsId }: { bbsId: string }) {
|
||||
router.push(`${pathname}/${row.pstNo}`);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
refetch();
|
||||
}, [pagination]);
|
||||
|
||||
return (
|
||||
<div className="card card-border !mt-6">
|
||||
<div className="card card-border">
|
||||
|
||||
Reference in New Issue
Block a user