fixing race conditions and such

This commit is contained in:
Arjun Patel
2022-01-14 21:36:11 -08:00
parent f2ca1fe5e1
commit 0299543f02
2 changed files with 22 additions and 5 deletions
+8 -2
View File
@@ -59,16 +59,22 @@ function RouteHandler() {
);
console.log(returnedTeamMembers);
// if the user is deleted from a team, don't let them go there
var teamId = "";
returnedTeamMembers.map((tm) => {
if (tm.status != TeamMemberStatus.deleted) {
console.log(
"in a team! going to the team dashboard of the first one!"
);
router.push("/teams/" + returnedTeamMembers[0].teamId);
return;
teamId = returnedTeamMembers[0].teamId;
}
});
if (teamId) {
router.push("/teams/" + teamId);
return;
}
setLoading(false);
} catch (error) {
console.log(error);