Skip to content

Commit

Permalink
fix: make it work if current_teams not exists for some reason in resp…
Browse files Browse the repository at this point in the history
…onse
  • Loading branch information
evereq authored Feb 2, 2024
1 parent 5b8b6a0 commit 660f782
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/web/app/[locale]/auth/passcode/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,18 @@ function WorkSpaceScreen({
if (form.workspaces.length === 1) {
setSelectedWorkspace(0);
}

const currentTeams = form.workspaces[0]?.current_teams;

if (
form.workspaces.length === 1 &&
form.workspaces[0].current_teams.length === 1
currentTeams?.length === 1
) {
setSelectedTeam(form.workspaces[0].current_teams[0].team_id);
setSelectedTeam(currentTeams[0].team_id);
}
if (
form.workspaces.length === 1 &&
form.workspaces[0].current_teams.length <= 1
(currentTeams?.length || 0) <= 1
) {
setTimeout(() => {
document.getElementById('continue-to-workspace')?.click();
Expand Down

0 comments on commit 660f782

Please sign in to comment.