Skip to content

Commit

Permalink
show InitializedByAnother when compareOwners fails
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrikMatiasko committed Sep 1, 2023
1 parent 801bfdd commit bef7c4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ const RemoteClientDetailPage: FC<any> = () => {
return (
<RemoteClientsPage>
{(clientData, wellKnownConfig) => {
// console.group('render Props')
// console.log(wellKnownConfig)
// console.log(clientData)
// console.log({ isInitialized: wellKnownConfig?.isInitialized })
// console.log({ reInitialization: clientData.reInitialization })
// console.groupEnd()

if (!wellKnownConfig || !wellKnownConfig.isInitialized) {
return <FullPageLoader i18n={{ loading: _(g.loading) }} />
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, useCallback, useMemo, useRef, useState } from 'react'
import { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useIntl } from 'react-intl'
import { Helmet } from 'react-helmet'
import jwtDecode from 'jwt-decode'
Expand Down Expand Up @@ -32,7 +32,7 @@ const RemoteClientsPage: FC<Props> = (props) => {
pageNotFound: _(g.pageNotFound),
},
})
const [httpGatewayAddress] = useState(getClientUrl(clientData?.clientUrl))
const [httpGatewayAddress] = useState(clientData ? getClientUrl(clientData?.clientUrl) : '')
const [loading, setLoading] = useState(false)
const [wellKnownConfig, setWellKnownConfig, reFetchConfig, wellKnownConfigError] = useWellKnownConfiguration(
httpGatewayAddress,
Expand Down Expand Up @@ -87,11 +87,15 @@ const RemoteClientsPage: FC<Props> = (props) => {
}
}

// TODO!
// setInitializedByAnother(true)
return false
}, [])

useEffect(() => {
if (!compareOwners(wellKnownConfig) && !initializedByAnother) {
setInitializedByAnother(true)
}
}, [compareOwners, initializedByAnother, wellKnownConfig])

const unauthorizedCallback = useCallback(() => {
setSuspectedUnauthorized(true)

Expand Down Expand Up @@ -125,8 +129,6 @@ const RemoteClientsPage: FC<Props> = (props) => {
clientAppSettings.setWellKnowConfig(wellKnownConfig)
clientAppSettings.setUseToken(compareOwners(wellKnownConfig) && clientData.authenticationMode === DEVICE_AUTH_MODE.X509)

console.log({ setUseToken: compareOwners(wellKnownConfig) && clientData.authenticationMode === DEVICE_AUTH_MODE.X509 })

if (wellKnownConfig.remoteProvisioning) {
clientAppSettings.setWebOAuthConfig({
authority: wellKnownConfig.remoteProvisioning.authority,
Expand Down

0 comments on commit bef7c4d

Please sign in to comment.