diff --git a/src/components/Group/GroupFeed/GroupFeed.jsx b/src/components/Group/GroupFeed/GroupFeed.jsx index 4b6e5458..db3d2198 100644 --- a/src/components/Group/GroupFeed/GroupFeed.jsx +++ b/src/components/Group/GroupFeed/GroupFeed.jsx @@ -18,8 +18,15 @@ const GroupFeed = ({ groupId, leaderName }) => { const [optionMenuOpenedFeedIndex, setOptionMenuOpenedFeedIndex] = useState(null); + const [isLoading, setIsLoading] = useState(true); + + const groupPostFetching = async () => { + await dispatch(getGroupAllPosts(groupId)); + setIsLoading(false); + }; + useEffect(() => { - dispatch(getGroupAllPosts(groupId)); + groupPostFetching(); }, []); const handleOnView = () => { @@ -28,6 +35,10 @@ const GroupFeed = ({ groupId, leaderName }) => { } }; + if (isLoading) { + return
로딩중
; + } + if (allGroupPosts.length === 0) { return ; } diff --git a/src/components/Group/GroupManagement/GroupMemberManagement/GroupMemberManagement.jsx b/src/components/Group/GroupManagement/GroupMemberManagement/GroupMemberManagement.jsx index 4fbb7127..3cfe2cfa 100644 --- a/src/components/Group/GroupManagement/GroupMemberManagement/GroupMemberManagement.jsx +++ b/src/components/Group/GroupManagement/GroupMemberManagement/GroupMemberManagement.jsx @@ -150,11 +150,12 @@ const GroupMemberManagement = ({ groupId, memberList }) => { memberInfo.accessLevel === data.accessLevel && ( {data.icon} - {data.accessLevel} + {memberInfo.accessLevel} ), )} + {isAccessChangeOpenIndex === memberInfo.member.userId && ( {ACCESS_LEVEL_DATA.map((data) => ( diff --git a/src/features/group/group-slice.js b/src/features/group/group-slice.js index 6f817be1..1d2ade4b 100644 --- a/src/features/group/group-slice.js +++ b/src/features/group/group-slice.js @@ -164,10 +164,23 @@ const groupSlice = createSlice({ state.isMemberListLoading = false; state.groupMemberList = payload; }) - .addCase(changeAccessLevel.fulfilled, (state) => { - state.isLoading = false; - toast.success("그룹원 권한이 변경되었습니다."); - }) + .addCase( + changeAccessLevel.fulfilled, + ( + state, + { + meta: { + arg: { userId, accessLevel }, + }, + }, + ) => { + state.isLoading = false; + toast.success("그룹원 권한이 변경되었습니다."); + state.groupMemberList[ + state.groupMemberList.findIndex((el) => el.member.userId === userId) + ].accessLevel = accessLevel; + }, + ) .addCase(withdrawalGroup.fulfilled, (state) => { state.isLoading = false; toast.error("그룹 탈퇴에 성공하였습니다");