diff --git a/src/pages/Dashboard/CompletionContent.tsx b/src/pages/Dashboard/CompletionContent.tsx index 73fa7c3..a837980 100755 --- a/src/pages/Dashboard/CompletionContent.tsx +++ b/src/pages/Dashboard/CompletionContent.tsx @@ -45,6 +45,7 @@ const CompletionContent: React.FC = ({ // 소셜 미디어 포스팅 모달 const [showSocialModal, setShowSocialModal] = useState(false); + const [videoDbId, setVideoDbId] = useState(null); // 저장된 완료 데이터 const [songCompletionData, setSongCompletionData] = useState<{ @@ -203,6 +204,10 @@ const CompletionContent: React.FC = ({ if (videoUrlFromResponse) { setVideoUrl(videoUrlFromResponse); + const videoId = statusResponse.render_data?.video_id; + if (videoId) { + setVideoDbId(videoId); + } setVideoStatus('complete'); setStatusMessage(''); saveToStorage(videoTaskId, currentSongTaskId, 'complete', videoUrlFromResponse); @@ -515,8 +520,8 @@ const CompletionContent: React.FC = ({ ; error_message: string | null; diff --git a/src/utils/api.ts b/src/utils/api.ts index 3062b4a..cf85190 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -301,6 +301,17 @@ export async function getVideosList(page: number = 1, pageSize: number = 10): Pr return response.json(); } +// task_id로 video_id 조회 (소셜 업로드용) +export async function getVideoIdByTaskId(taskId: string): Promise { + try { + const response = await getVideosList(1, 50); + const found = response.items.find(v => v.task_id === taskId); + return found?.video_id ?? null; + } catch { + return null; + } +} + // 비디오 삭제 API (개별 비디오 삭제) export async function deleteVideo(videoId: number): Promise { const response = await authenticatedFetch(`${API_URL}/archive/videos/${videoId}`, {