import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { Toaster } from '@/components/ui/toaster'
import { useAuthStore } from '@/store/auth'
import LoginPage from '@/pages/Login'
import Dashboard from '@/pages/Dashboard'
import StoragePage from '@/pages/Storage'
import AlertsPage from '@/pages/Alerts'
import Layout from '@/components/Layout'
// Create a client
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: 1,
staleTime: 5 * 60 * 1000, // 5 minutes
},
},
})
// Protected Route Component
function ProtectedRoute({ children }: { children: React.ReactNode }) {
const { isAuthenticated } = useAuthStore()
if (!isAuthenticated) {
return
}
return <>{children}>
}
function App() {
return (
} />
}
>
} />
} />
} />
)
}
export default App