A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.
fix: resolves broken redirect on login page
towfiqi1ef076a41d46
diff --git a/frontend/src/router.tsx b/frontend/src/router.tsxindex 20cba49..f599aa7 100644--- a/frontend/src/router.tsx+++ b/frontend/src/router.tsx@@ -14,6 +14,24 @@ import Footer from './components/App/Footer/Footer';import NotFoundRoute from './routes/NotFoundRoute/NotFoundRoute';import Icon from './components/common/Icon/Icon';+function PublicRoute({ children }: { children: React.ReactNode }) {+ const { data: authData, isLoading: authLoading } = useAuth();++ if (authLoading) {+ return (+ <div className="loadingScreen">+ <Icon size={60} type="loading" />+ </div>+ );+ }++ if (authData) {+ return <Navigate to="/" replace />;+ }++ return <>{children}</>;+}+function ProtectedLayout() {// Check setup status FIRST - this endpoint doesn't require auth// and tells us if we're in binary mode and if setup is pending@@ -74,7 +92,14 @@ export function AppRoutes() {<Route path={'plan/:id'} element={<PlanSingle />} /><Route path="*" element={<NotFoundRoute />} /></Route>- <Route path="login" element={<Login />} />+ <Route+ path="login"+ element={+ <PublicRoute>+ <Login />+ </PublicRoute>+ }+ /><Route path="setup" element={<Setup />} /></Routes>);diff --git a/frontend/src/services/users.ts b/frontend/src/services/users.tsindex 32b431e..3cf2da1 100644--- a/frontend/src/services/users.ts+++ b/frontend/src/services/users.ts@@ -1,5 +1,5 @@import { API_URL } from '../utils/constants';-import { useQuery, useMutation } from '@tanstack/react-query';+import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';import { useNavigate } from 'react-router';interface LoginCredentials {@@ -87,9 +87,11 @@ export async function logoutUser() {export function useLogout() {const navigate = useNavigate();+ const queryClient = useQueryClient();return useMutation({mutationFn: logoutUser,onSuccess: () => {+ queryClient.removeQueries({ queryKey: ['auth'] });navigate('/login');},});