@@ -30,36 +30,40 @@ export const App = () => {
3030 configuration ( )
3131 . then ( res => {
3232 useAppStore . setState ( ( ) => ( { config : res } ) ) ;
33+
3334 if ( ! res . authenticated ) {
3435 if ( ! res . name ) {
3536 const direction = window . location . pathname + window . location . search ;
3637 localStorage . setItem ( "location" , direction ) ;
3738 } else if ( ! isEmpty ( res . missingAttributes ) ) {
38- setLoading ( false ) ;
3939 navigate ( "/missingAttributes" ) ;
40+ setLoading ( false ) ;
4041 return ;
4142 }
42- setLoading ( false ) ;
4343 const locationStored = localStorage . getItem ( "location" ) ;
4444 const pathname = locationStored || window . location . pathname ;
45- const isInvitationAcceptFlow = window . location . pathname . startsWith ( "/invitation/accept" ) ;
45+ const isInvitationAcceptFlow = window . location . pathname . startsWith ( "/invitation/accept" )
46+ || pathname . startsWith ( "/invitation/accept" ) ;
4647 if ( res . name && ! pathname . startsWith ( "/invitation/accept" ) && ! isInvitationAcceptFlow ) {
4748 navigate ( "/deadend" ) ;
48- } else if ( pathname === "/" || pathname . startsWith ( "/login" ) || pathname . startsWith ( "/invitation/accept" ) || isInvitationAcceptFlow ) {
49- navigate ( isInvitationAcceptFlow ? ( window . location . pathname + window . location . search ) : pathname ) ;
49+ } else if ( pathname === "/" || pathname . startsWith ( "/login" ) || isInvitationAcceptFlow ) {
50+ const route = isInvitationAcceptFlow ? pathname : ( window . location . pathname + window . location . search ) ;
51+ setTimeout ( ( ) => navigate ( route ) , 15 ) ;
52+ navigate ( route ) ;
5053 } else {
5154 //Bookmarked URL's trigger a direct login and skip the landing page
5255 login ( res ) ;
5356 }
57+ setLoading ( false ) ;
5458 } else {
5559 me ( )
5660 . then ( res => {
5761 useAppStore . setState ( ( ) => ( { user : res , authenticated : true } ) ) ;
5862 const location = localStorage . getItem ( "location" ) || window . location . pathname + window . location . search ;
5963 const newLocation = location . startsWith ( "/login" ) ? "/profile" : location ;
6064 localStorage . removeItem ( "location" ) ;
61- setLoading ( false ) ;
6265 navigate ( newLocation ) ;
66+ setLoading ( false ) ;
6367 } ) ;
6468 }
6569 } )
@@ -73,6 +77,7 @@ export const App = () => {
7377 if ( loading ) {
7478 return < Loader />
7579 }
80+
7681 return (
7782 < div className = "access" >
7883 < div className = "container" >
@@ -92,8 +97,7 @@ export const App = () => {
9297 < Routes >
9398 < Route path = "/" element = { < Navigate replace to = "login" /> } />
9499 < Route path = "proceed" element = { < Proceed /> } />
95- < Route path = "invitation/accept"
96- element = { < Invitation authenticated = { false } /> } />
100+ < Route path = "invitation/accept" element = { < Invitation authenticated = { false } /> } />
97101 < Route path = "login" element = { < Login /> } />
98102 < Route path = "deadend" element = { < InviteOnly /> } />
99103 < Route path = "missingAttributes" element = { < MissingAttributes /> } />
0 commit comments