We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6678fcd commit 59ec112Copy full SHA for 59ec112
components/auth/login.tsx
@@ -35,7 +35,13 @@ export function LoginComponent() {
35
async function onSubmit(values: LoginInput) {
36
try {
37
const userData = await login(values.email, values.password);
38
- if (userData.orgs && userData.orgs.length > 0) {
+
39
+ // Check if user is superuser first
40
+ if (userData.isSuperuser) {
41
+ router.push("/admin");
42
+ }
43
+ // Otherwise check for orgs
44
+ else if (userData.orgs && userData.orgs.length > 0) {
45
router.push(`/${userData.orgs[0].nameId}`);
46
} else {
47
router.push("/onboarding");
contexts/auth-context.tsx
@@ -16,6 +16,7 @@ interface User {
16
email: string;
17
name: string;
18
orgs: Org[];
19
+ isSuperuser: boolean;
20
}
21
22
interface AuthContextType {
0 commit comments