Skip to content

Commit

Permalink
feat: implement conditional routing after login
Browse files Browse the repository at this point in the history
  • Loading branch information
ccatherinetan committed May 1, 2024
1 parent 259acbd commit aece833
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import isEmail from 'validator/lib/isEmail';
import { H4Centered, SpacerDiv } from '@/app/(auth)/styles';
import { BigBlueButton } from '@/components/Buttons';
import TextInput from '@/components/TextInput/index';
import CONFIG from '@/lib/configs';
import COLORS from '@/styles/colors';
import { H1, LinkColored, P } from '@/styles/text';
import { useAuth } from '@/utils/AuthProvider';
Expand Down Expand Up @@ -44,7 +45,13 @@ export default function Login() {
} else {
profile?.loadProfile();
setErrorMessage('');
push('/cases');
// conditional routing after log in
if (!profile?.profileData) push(CONFIG.onboardingHome);
else if (profile.roles.map(r => r.role).includes('ATTORNEY'))
push('/cases');
else if (profile.roles.map(r => r.role).includes('LEGAL_FELLOW'))
push('/limited-case-assignments');
else push('/language-support');
}
};

Expand Down

0 comments on commit aece833

Please sign in to comment.