Skip to content
Snippets Groups Projects
Commit 819ed079 authored by Bernard Roland (Student Com20)'s avatar Bernard Roland (Student Com20)
Browse files

Quick fix for a fatal error with the teams page

parent d218c164
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,7 @@ export default function TaskDetail() {
});
getTaskAssignees(taskId).then(setAssignees);
setAssignment(task.assigned.find(a => a.user === userId))
}).catch(() => history.goBack());
}).catch(() => {});
}, [taskId, userId, history]);
if (task) {
......
......@@ -30,20 +30,19 @@ export default function Teams() {
const { teamId: teamParamId } = useParams<Params>();
const lastTeam = sessionStorage.getItem('last-selected-team');
const teamId = teamParamId ?? lastTeam ?? teams?.[0]?.id
sessionStorage.setItem('last-selected-team', teamId);
if (teamId) {
sessionStorage.setItem('last-selected-team', teamId);
}
let currentTeam = teams?.find(team => team.id === teamId);
useEffect(() => {
if (teams && (!currentTeam || !teamParamId)) {
if (teams.length > 0) {
// if no team is defined, take the first one
history.replace('/teams/' + teamId);
} else {
history.push('/introduction');
}
if (teamId && !teamParamId) {
history.replace('/teams/' + teamId);
} else if (teams && teams.length === 0) {
history.push('/introduction');
}
});
}, [teamId, teamParamId, teams, history]);
useEffect(() => {
getTeams().then(setTeams);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment