@@ -43,7 +43,6 @@ import { TOKEN_COOKIE_NAME, URLS } from '../../config'
43
43
import { getSSOConfigList } from '../../Pages/GlobalConfigurations/Authorization/SSOLoginServices/service'
44
44
import { dashboardAccessed } from '../../services/service'
45
45
import { LOGIN_CARD_ANIMATION_VARIANTS , SSOProvider } from './constants'
46
- import { SSOConfigLoginList } from './login.types'
47
46
import { LoginForm } from './LoginForm'
48
47
49
48
import './login.scss'
@@ -54,13 +53,14 @@ const getTermsAndConditions = importComponentFromFELibrary('getTermsAndCondition
54
53
55
54
const Login = ( ) => {
56
55
const [ continueUrl , setContinueUrl ] = useState ( '' )
57
- const [ loginList , setLoginList ] = useState < SSOConfigLoginList [ ] > ( [ ] )
58
56
59
57
const { searchParams } = useSearchString ( )
60
58
const location = useLocation ( )
61
59
const history = useHistory ( )
62
60
63
- const [ initLoading , initResult ] = useAsync ( ( ) => Promise . allSettled ( [ getSSOConfigList ( ) , dashboardAccessed ( ) ] ) , [ ] )
61
+ const [ ssoListLoading , ssoListResponse ] = useAsync ( getSSOConfigList , [ ] )
62
+
63
+ const loginList = ssoListResponse ?. result ?? [ ]
64
64
65
65
const setLoginNavigationURL = ( ) => {
66
66
let queryParam = searchParams . continue
@@ -96,26 +96,10 @@ const Login = () => {
96
96
97
97
useEffect ( ( ) => {
98
98
setLoginNavigationURL ( )
99
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
100
+ dashboardAccessed ( )
99
101
} , [ ] )
100
102
101
- useEffect ( ( ) => {
102
- if ( initResult && ! initLoading ) {
103
- const [ ssoLoginListResponse , dashboardAccessesResponse ] = initResult
104
- if ( ssoLoginListResponse . status === 'fulfilled' && ssoLoginListResponse . value . result ) {
105
- setLoginList ( ssoLoginListResponse . value . result as SSOConfigLoginList [ ] )
106
- }
107
-
108
- if (
109
- typeof Storage !== 'undefined' &&
110
- ! localStorage . getItem ( 'isDashboardAccessed' ) &&
111
- dashboardAccessesResponse . status === 'fulfilled' &&
112
- dashboardAccessesResponse . value . result
113
- ) {
114
- localStorage . setItem ( 'isDashboardAccessed' , 'true' )
115
- }
116
- }
117
- } , [ initLoading , initResult ] )
118
-
119
103
const onClickSSO = ( ) => {
120
104
if ( typeof Storage !== 'undefined' ) {
121
105
localStorage . setItem ( 'isSSOLogin' , 'true' )
@@ -127,7 +111,7 @@ const Login = () => {
127
111
128
112
const renderSSOLoginPage = ( ) => (
129
113
< div className = "flexbox-col dc__gap-12 p-36" >
130
- { initLoading && ! loginList . length && (
114
+ { ssoListLoading && ! loginList . length && (
131
115
< Button
132
116
variant = { ButtonVariantType . secondary }
133
117
text = "Checking SSO"
0 commit comments