Skip to content

Commit

Permalink
fix: enterprise routes 404 when not logged in (#8640)
Browse files Browse the repository at this point in the history
Evaluate `*` with login redirect before showing 404s.
  • Loading branch information
Tymek authored Nov 4, 2024
1 parent b9df506 commit e7c2bf0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion frontend/src/component/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand All @@ -47,6 +48,8 @@ export const App = () => {
}
}, [authDetails, user]);

const isLoggedIn = Boolean(user?.id);

return (
<SWRProvider>
<Suspense fallback={<Loader type='fullscreen' />}>
Expand Down Expand Up @@ -92,7 +95,13 @@ export const App = () => {
/>
<Route
path='*'
element={<NotFound />}
element={
isLoggedIn ? (
<NotFound />
) : (
<LoginRedirect />
)
}
/>
</Routes>

Expand Down

0 comments on commit e7c2bf0

Please sign in to comment.