Skip to content

Commit

Permalink
Fix: 메인 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
goeun208 committed Mar 12, 2024
1 parent e3d21bd commit e082e57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
15 changes: 7 additions & 8 deletions src/components/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,20 @@ const Main = ({ id }: MainProps) => {
useEffect(() => {
console.log(gData, 'gData');
groupData !== gData && setGroupData(gData);
if (groupData) {
setLat(groupData?.data[0].latitude);
setLng(groupData?.data[0].longitude);
setLocal(groupData?.data[0].name);
setUserPath(groupData?.data[0].moveUserInfo.filter((item: any) => item.userId === userId));
setOtherUserPath(groupData?.data[0].moveUserInfo.filter((item: any) => item.userId != userId));
}
}, [gData, groupData]);

useEffect(() => {
console.log(gNameData, 'gNameData');
groupNameData !== gNameData && setGroupNameData(gNameData);
}, [gNameData, groupNameData]);

if (groupData) {
setLat(groupData?.data[0].latitude);
setLng(groupData?.data[0].longitude);
setLocal(groupData?.data[0].name);
setUserPath(groupData?.data[0].moveUserInfo.filter((item: any) => item.userId === userId));
setOtherUserPath(groupData?.data[0].moveUserInfo.filter((item: any) => item.userId != userId));
}

if (groupNameData) {
sessionStorage.setItem('adminId', groupNameData?.data?.adminEmail);
}
Expand Down
8 changes: 5 additions & 3 deletions src/pages/main/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ const MainPage = (props: any) => {
console.log(props, 'props');
return (
<>
<DefaultLayout>
<Main id={props.id} />
</DefaultLayout>
{props && (
<DefaultLayout>
<Main id={props.id} />
</DefaultLayout>
)}
</>
);
};
Expand Down

0 comments on commit e082e57

Please sign in to comment.