Skip to content

Commit 92c43d1

Browse files
committed
fix: 상세페이지 hostChannelId 에러 해결
1 parent d707319 commit 92c43d1

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

src/features/event-manage/event-create/ui/LinkInput.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ interface LinkInputProps {
1313
export interface Link {
1414
title: string;
1515
url: string;
16-
address: string;
17-
detailAddress: string;
1816
}
1917

2018
const LinkInput = ({ value, onChange, setEventState }: LinkInputProps) => {
@@ -36,8 +34,6 @@ const LinkInput = ({ value, onChange, setEventState }: LinkInputProps) => {
3634
const newLink = {
3735
title: '',
3836
url: '',
39-
address: '',
40-
detailAddress: '',
4137
};
4238
updateAll([...links, newLink]);
4339
};

src/pages/dashboard/ui/EventDetailPage.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ const EventDetailPage = () => {
1414
const { data } = useEventDetail();
1515
const { mutate } = useUpdateEventHook();
1616

17+
const [hostChannelId, setHostChannelId] = useState<number>(0);
1718
const [bannerImageUrl, setBannerImageUrl] = useState('');
1819
const [description, setDescription] = useState('');
1920
const [referenceLinks, setReferenceLinks] = useState<Link[]>([]);
2021

2122
useEffect(() => {
2223
if (data?.result) {
24+
setHostChannelId(data.result.hostChannelId || 0);
2325
setBannerImageUrl(data.result.bannerImageUrl || '');
2426
setDescription(data.result.description || '');
2527
setReferenceLinks(data.result.referenceLinks || []);
@@ -31,24 +33,22 @@ const EventDetailPage = () => {
3133

3234
const formatData = formatEventRequest(data.result);
3335

34-
mutate(
35-
{
36-
...formatData,
37-
bannerImageUrl,
38-
description,
39-
referenceLinks,
40-
hostChannelId: 1,
36+
const finalPayload = {
37+
...formatData,
38+
hostChannelId,
39+
bannerImageUrl,
40+
description,
41+
referenceLinks: referenceLinks.map(({ title, url }) => ({ title, url })),
42+
};
43+
mutate(finalPayload, {
44+
onSuccess: () => {
45+
alert('이벤트 정보가 저장되었습니다.');
46+
navigate(`/dashboard/${data?.result.id}`);
4147
},
42-
{
43-
onSuccess: () => {
44-
alert('이벤트 정보가 저장되었습니다.');
45-
navigate(`/dashboard/${data?.result.id}`);
46-
},
47-
onError: () => {
48-
alert('저장에 실패했습니다.');
49-
},
50-
}
51-
);
48+
onError: () => {
49+
alert('저장에 실패했습니다.');
50+
},
51+
});
5252
};
5353

5454
return (

0 commit comments

Comments
 (0)