File tree Expand file tree Collapse file tree
packages/react-ui/src/app Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import { projectHooks } from '@/app/common/hooks/project-hooks';
1010import { userSettingsHooks } from '@/app/common/hooks/user-settings-hooks' ;
1111import { SocketProvider } from '@/app/common/providers/socket-provider' ;
1212// eslint-disable-next-line import/no-restricted-paths
13+ import { getFederatedUrlBasedOnFlags } from '@/app/features/authentication/lib/utils' ;
14+ // eslint-disable-next-line import/no-restricted-paths
1315import { appConnectionsHooks } from '@/app/features/connections/lib/app-connections-hooks' ;
1416import { authenticationSession } from '@/app/lib/authentication-session' ;
1517import { navigationUtil } from '@/app/lib/navigation-util' ;
@@ -61,7 +63,7 @@ export const AllowOnlyLoggedInUserOnlyGuard = ({
6163 await authenticationSession . logOut ( {
6264 userInitiated : false ,
6365 navigate,
64- federatedLoginUrl : flags ?. FRONTEGG_URL as string | undefined ,
66+ federatedLoginUrl : getFederatedUrlBasedOnFlags ( flags ) ,
6567 } ) ;
6668 } catch ( e ) {
6769 if ( isMounted ) {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828} from '@openops/shared' ;
2929import { useEffect } from 'react' ;
3030import { navigationUtil } from '../../../lib/navigation-util' ;
31+ import { getFederatedUrlBasedOnFlags } from '../lib/utils' ;
3132
3233const SignInSchema = Type . Object ( {
3334 email : Type . String ( {
@@ -60,7 +61,7 @@ const SignInForm: React.FC = () => {
6061 }
6162 authenticationSession . logOut ( {
6263 userInitiated : false ,
63- federatedLoginUrl : flags ?. FRONTEGG_URL as string | undefined ,
64+ federatedLoginUrl : getFederatedUrlBasedOnFlags ( flags ) ,
6465 } ) ;
6566 } , [ flags ] ) ;
6667
Original file line number Diff line number Diff line change 1+ import { FlagsMap } from '@/app/lib/flags-api' ;
2+
3+ export const getFederatedUrlBasedOnFlags = ( flags : FlagsMap ) =>
4+ flags . FEDERATED_LOGIN_ENABLED
5+ ? ( flags . FRONTEGG_URL as string | undefined )
6+ : undefined ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { authenticationSession } from '@/app/lib/authentication-session';
33import axios , { AxiosError , HttpStatusCode } from 'axios' ;
44import { OPENOPS_CLOUD_USER_INFO_API_URL } from './constants/cloud' ;
55import { QueryKeys } from './constants/query-keys' ;
6+ import { getFederatedUrlBasedOnFlags } from './features/authentication/lib/utils' ;
67import { FlagsMap } from './lib/flags-api' ;
78import { queryClient } from './lib/query-client' ;
89
@@ -60,12 +61,13 @@ axios.interceptors.response.use(
6061 if ( url !== OPENOPS_CLOUD_USER_INFO_API_URL && ! isSignInRoute ) {
6162 console . warn ( 'JWT expired logging out' ) ;
6263
63- const flags = queryClient . getQueryData < FlagsMap > ( [ QueryKeys . flags ] ) ;
64+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
65+ const flags = queryClient . getQueryData < FlagsMap > ( [ QueryKeys . flags ] ) ! ;
6466 authenticationSession . logOut ( {
6567 userInitiated : false ,
66- federatedLoginUrl : flags ?. FRONTEGG_URL as string | undefined ,
68+ federatedLoginUrl : getFederatedUrlBasedOnFlags ( flags ) ,
6769 } ) ;
68- if ( ! flags ?. FRONTEGG_URL ) {
70+ if ( ! flags ?. FEDERATED_LOGIN_ENABLED ) {
6971 window . location . reload ( ) ;
7072 }
7173 }
You can’t perform that action at this time.
0 commit comments