mirror of
https://github.com/ktds-dg0501/kt-event-marketing-fe.git
synced 2026-01-21 20:56:22 +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);
|
await requestAIRecommendations(newEventId);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error('이벤트 생성 실패:', err);
|
console.error('이벤트 생성 실패:', err);
|
||||||
setError(err.response?.data?.message || '이벤트 생성에 실패했습니다');
|
setError(err.response?.data?.message || err.message || '이벤트 생성에 실패했습니다');
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export async function POST(request: NextRequest) {
|
|||||||
const { objective } = body;
|
const { objective } = body;
|
||||||
|
|
||||||
// 백엔드 API 호출 시도
|
// 백엔드 API 호출 시도
|
||||||
const backendUrl = 'http://localhost:8080/api/v1/events/objectives';
|
const backendUrl = 'http://localhost:8080/api/events/objectives';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const backendResponse = await fetch(backendUrl, {
|
const backendResponse = await fetch(backendUrl, {
|
||||||
@ -34,17 +34,14 @@ export async function POST(request: NextRequest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 백엔드 실패 시 Mock 데이터 반환
|
// 백엔드 실패 시 Mock 데이터 반환
|
||||||
|
// shared/api/eventApi의 selectObjective가 반환하는 형식과 일치
|
||||||
const mockEventId = `evt_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
const mockEventId = `evt_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
||||||
|
|
||||||
const mockResponse = {
|
const mockResponse = {
|
||||||
success: true,
|
eventId: mockEventId,
|
||||||
data: {
|
objective: objective,
|
||||||
eventId: mockEventId,
|
status: 'DRAFT' as const,
|
||||||
objective,
|
createdAt: new Date().toISOString(),
|
||||||
status: 'DRAFT',
|
|
||||||
createdAt: new Date().toISOString(),
|
|
||||||
},
|
|
||||||
message: '이벤트가 생성되었습니다 (Mock)',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('🎭 Mock API Response:', mockResponse);
|
console.log('🎭 Mock API Response:', mockResponse);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user