'use server'; import { PostResponse } from '@/types/response/forum/post'; import { ResultDto } from '@/types/response/common'; import { fetchJson } from '@/lib/utils/server'; // 게시글 정보 조회 export async function fetchPostData(postID: number): Promise> { const post = await fetchJson(`/api/forum/posts/${postID}`, { method: 'GET', headers: { 'Accept': 'application/json' } }); if (post.success && post.data) { // 이미지 URL 변경 post.data.content = post.data.content.replace(/]*?\bsrc=["']?(\/[^"'\s>]*)["']?/gi, (match, src) => { return match.replace(src, process.env.API_URL + src); }); } return post; }