fix: remove backend health check to prevent 404 errors

- Remove unnecessary backend connectivity check in Layout component
- Simplify Layout component by removing unused imports and state
- Application now works seamlessly in demo mode without backend errors
- Clean console output without 404 errors on startup
This commit is contained in:
Nicolas Cantu 2025-09-10 18:27:11 +02:00
parent 0b14fbe6b7
commit 91b44e06ad
2 changed files with 3 additions and 39 deletions

View File

@ -1,8 +1,7 @@
import React from 'react' import React from 'react'
import { AppBar, Toolbar, Typography, Container, Box, Alert, Snackbar } from '@mui/material' import { AppBar, Toolbar, Typography, Container, Box } from '@mui/material'
import { useNavigate, useLocation } from 'react-router-dom' import { useNavigate, useLocation } from 'react-router-dom'
import { NavigationTabs } from './NavigationTabs' import { NavigationTabs } from './NavigationTabs'
import { useState, useEffect } from 'react'
interface LayoutProps { interface LayoutProps {
children: React.ReactNode children: React.ReactNode
@ -11,26 +10,6 @@ interface LayoutProps {
export const Layout: React.FC<LayoutProps> = ({ children }) => { export const Layout: React.FC<LayoutProps> = ({ children }) => {
const navigate = useNavigate() const navigate = useNavigate()
const location = useLocation() const location = useLocation()
const [showDemoAlert, setShowDemoAlert] = useState(false)
useEffect(() => {
// Vérifier si le backend est accessible
const checkBackend = async () => {
try {
const response = await fetch('http://localhost:8000/health', {
method: 'GET',
signal: AbortSignal.timeout(2000)
})
if (!response.ok) {
setShowDemoAlert(true)
}
} catch (error) {
setShowDemoAlert(true)
}
}
checkBackend()
}, [])
return ( return (
<Box sx={{ flexGrow: 1 }}> <Box sx={{ flexGrow: 1 }}>
@ -52,21 +31,6 @@ export const Layout: React.FC<LayoutProps> = ({ children }) => {
<Container maxWidth="xl" sx={{ mt: 3, mb: 3 }}> <Container maxWidth="xl" sx={{ mt: 3, mb: 3 }}>
{children} {children}
</Container> </Container>
<Snackbar
open={showDemoAlert}
autoHideDuration={6000}
onClose={() => setShowDemoAlert(false)}
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
>
<Alert
onClose={() => setShowDemoAlert(false)}
severity="info"
sx={{ width: '100%' }}
>
Mode démonstration activé - Backend non accessible
</Alert>
</Snackbar>
</Box> </Box>
) )
} }