diff --git a/src/pages/GroupMembersPage/ExpelBtn/index.tsx b/src/pages/GroupMembersPage/ExpelBtn/index.tsx index bef2681..acc6e58 100644 --- a/src/pages/GroupMembersPage/ExpelBtn/index.tsx +++ b/src/pages/GroupMembersPage/ExpelBtn/index.tsx @@ -29,6 +29,8 @@ export default function ExpelBtn({ mutationFn: () => expelMember({ groupId, userId }), onSuccess: () => { queryClient.invalidateQueries({ queryKey: ['expelMember'] }) + queryClient.invalidateQueries({ queryKey: ['group', 'member', groupId] }) + queryClient.invalidateQueries({ queryKey: ['membersManage', groupId] }) window.location.reload() }, onError: () => { diff --git a/src/pages/GroupPage/ExitGroupButton/index.tsx b/src/pages/GroupPage/ExitGroupButton/index.tsx index ffd2f41..7ccfbf8 100644 --- a/src/pages/GroupPage/ExitGroupButton/index.tsx +++ b/src/pages/GroupPage/ExitGroupButton/index.tsx @@ -12,6 +12,7 @@ import { ConfirmModalButton, } from '@/components/Modal/ConfirmModal' import { useMembersLengthStore } from '@/stores/members-length' +import { useSelectedGroupStore } from '@/stores/selected-group' import { GroupRole } from '@/types' interface ExitGroupButtonProps { @@ -28,11 +29,15 @@ export const ExitGroupButton = ({ const warningAlert = useDisclosure() const errorAlert = useDisclosure() const navigate = useNavigate() + const setSelectedGroup = useSelectedGroupStore( + (state) => state.setSelectedGroup + ) const { mutate: exitGroup } = useMutation({ mutationFn: () => exitGroupMember(groupId), onSuccess: () => { queryClient.invalidateQueries({ queryKey: ['groups'] }) + setSelectedGroup(undefined) navigate('/') }, })