Skip to content

Commit

Permalink
feat(groupviewexploremain.jsx): refresh screen when user exits
Browse files Browse the repository at this point in the history
  • Loading branch information
junglesub committed Aug 5, 2024
1 parent fde0666 commit 31cf13c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function GroupViewExploreCard({
hoverDelete = false,
clickJoin = false,
data = {},
cb = () => {},
}) {
const fetchBe = useFetchBe();
const navigate = useNavigate();
Expand Down Expand Up @@ -58,7 +59,8 @@ function GroupViewExploreCard({
src={ExitIcon}
draggable={false}
onClick={async () => {
fetchBe("/team/exit/" + data.teamId, "PATCH");
await fetchBe("/team/exit/" + data.teamId, "PATCH");
cb();
}}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ function GroupViewExploreMain() {
}, {});
}, [allGroups]);

useEffect(() => {
const getGroupDatas = () => {
fetchBe("/team/allGroups").then((json) => setAllGroups(json.teams));
fetchBe("/user/getGroups").then((json) => setMyGroups(json.teams));
};

useEffect(() => {
getGroupDatas();
}, []);

if (!allGroups || !myGroups) return <div></div>;
Expand Down Expand Up @@ -70,6 +74,7 @@ function GroupViewExploreMain() {
data={allGroupByCode[code]}
hoverDelete={true}
clickJoin={true}
cb={getGroupDatas}
/>
))}
<HoverImageSpan onClick={() => setModalOpen("create")}>
Expand Down

0 comments on commit 31cf13c

Please sign in to comment.