Skip to content

Commit

Permalink
Tournament: Fix when user leaves a tournament room
Browse files Browse the repository at this point in the history
  • Loading branch information
hanmpark committed Nov 14, 2024
1 parent 19a1a75 commit e1c55ff
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/src/context/TournamentContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ const TournamentProvider = ({ children }) => {
participants: prevTournament.participants.filter(p => p.userID !== data.user.userID)
}
});
if (data?.user?.userID === userIDRef.current) {
setUser(prev => ({
...prev,
tournamentID: null,
}));
setTournament(null);
navigate('/tournaments');
}
}
} else {
setTournament({
Expand Down

0 comments on commit e1c55ff

Please sign in to comment.