File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,13 @@ export function LoginComponent() {
35
35
async function onSubmit ( values : LoginInput ) {
36
36
try {
37
37
const userData = await login ( values . email , values . password ) ;
38
- if ( userData . orgs && userData . orgs . length > 0 ) {
38
+
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 ) {
39
45
router . push ( `/${ userData . orgs [ 0 ] . nameId } ` ) ;
40
46
} else {
41
47
router . push ( "/onboarding" ) ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ interface User {
16
16
email : string ;
17
17
name : string ;
18
18
orgs : Org [ ] ;
19
+ isSuperuser : boolean ;
19
20
}
20
21
21
22
interface AuthContextType {
You can’t perform that action at this time.
0 commit comments