mirror of
https://github.com/ktds-dg0501/kt-event-marketing-fe.git
synced 2026-01-21 19:36:25 +00:00
이벤트 생성 API 호출 오류 수정
- RecommendationStep: selectObjective 메서드 사용으로 수정 - Mock API: 응답 형식을 shared/api/eventApi에 맞춤 - 빌드 오류 해결 및 정상 동작 확인
This commit is contained in:
parent
ddc7bc143f
commit
4e4d9dd313
@ -91,7 +91,7 @@ export default function RecommendationStep({
|
||||
await requestAIRecommendations(newEventId);
|
||||
} catch (err: any) {
|
||||
console.error('이벤트 생성 실패:', err);
|
||||
setError(err.response?.data?.message || '이벤트 생성에 실패했습니다');
|
||||
setError(err.response?.data?.message || err.message || '이벤트 생성에 실패했습니다');
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
@ -12,7 +12,7 @@ export async function POST(request: NextRequest) {
|
||||
const { objective } = body;
|
||||
|
||||
// 백엔드 API 호출 시도
|
||||
const backendUrl = 'http://localhost:8080/api/v1/events/objectives';
|
||||
const backendUrl = 'http://localhost:8080/api/events/objectives';
|
||||
|
||||
try {
|
||||
const backendResponse = await fetch(backendUrl, {
|
||||
@ -34,17 +34,14 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
|
||||
// 백엔드 실패 시 Mock 데이터 반환
|
||||
// shared/api/eventApi의 selectObjective가 반환하는 형식과 일치
|
||||
const mockEventId = `evt_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
||||
|
||||
const mockResponse = {
|
||||
success: true,
|
||||
data: {
|
||||
eventId: mockEventId,
|
||||
objective,
|
||||
status: 'DRAFT',
|
||||
objective: objective,
|
||||
status: 'DRAFT' as const,
|
||||
createdAt: new Date().toISOString(),
|
||||
},
|
||||
message: '이벤트가 생성되었습니다 (Mock)',
|
||||
};
|
||||
|
||||
console.log('🎭 Mock API Response:', mockResponse);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user