1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: enterprise routes 404 when not logged in (#8640)

Evaluate `*` with login redirect before showing 404s.
This commit is contained in:
Tymoteusz Czech 2024-11-04 14:01:33 +01:00 committed by GitHub
parent b9df5060ca
commit e7c2bf0df0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,7 @@ import { InternalBanners } from './banners/internalBanners/InternalBanners';
import { ExternalBanners } from './banners/externalBanners/ExternalBanners';
import { LicenseBanner } from './banners/internalBanners/LicenseBanner';
import { Demo } from './demo/Demo';
import { LoginRedirect } from './common/LoginRedirect/LoginRedirect';
const StyledContainer = styled('div')(() => ({
'& ul': {
@ -47,6 +48,8 @@ export const App = () => {
}
}, [authDetails, user]);
const isLoggedIn = Boolean(user?.id);
return (
<SWRProvider>
<Suspense fallback={<Loader type='fullscreen' />}>
@ -92,7 +95,13 @@ export const App = () => {
/>
<Route
path='*'
element={<NotFound />}
element={
isLoggedIn ? (
<NotFound />
) : (
<LoginRedirect />
)
}
/>
</Routes>