diff --git a/http-gateway/web/src/containers/RemoteClients/Detail/RemoteClientDetailPage.tsx b/http-gateway/web/src/containers/RemoteClients/Detail/RemoteClientDetailPage.tsx index b9e6abf12..6306ac570 100644 --- a/http-gateway/web/src/containers/RemoteClients/Detail/RemoteClientDetailPage.tsx +++ b/http-gateway/web/src/containers/RemoteClients/Detail/RemoteClientDetailPage.tsx @@ -15,13 +15,6 @@ const RemoteClientDetailPage: FC = () => { return ( {(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 } diff --git a/http-gateway/web/src/containers/RemoteClients/RemoteClientsPage/RemoteClientsPage.tsx b/http-gateway/web/src/containers/RemoteClients/RemoteClientsPage/RemoteClientsPage.tsx index 2e87be43b..e275b4bd2 100644 --- a/http-gateway/web/src/containers/RemoteClients/RemoteClientsPage/RemoteClientsPage.tsx +++ b/http-gateway/web/src/containers/RemoteClients/RemoteClientsPage/RemoteClientsPage.tsx @@ -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' @@ -32,7 +32,7 @@ const RemoteClientsPage: FC = (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, @@ -87,11 +87,15 @@ const RemoteClientsPage: FC = (props) => { } } - // TODO! - // setInitializedByAnother(true) return false }, []) + useEffect(() => { + if (!compareOwners(wellKnownConfig) && !initializedByAnother) { + setInitializedByAnother(true) + } + }, [compareOwners, initializedByAnother, wellKnownConfig]) + const unauthorizedCallback = useCallback(() => { setSuspectedUnauthorized(true) @@ -125,8 +129,6 @@ const RemoteClientsPage: FC = (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,