personal account
This commit is contained in:
@@ -6,16 +6,25 @@ import FamilyView from './pages/FamilyView';
|
||||
import AdminPanel from './pages/AdminPanel';
|
||||
import NoFamily from './pages/NoFamily';
|
||||
import InvitePage from './pages/InvitePage';
|
||||
import Profile from './pages/Profile';
|
||||
import { useStore } from './store/useStore';
|
||||
import { authApi } from './api/client';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
|
||||
function AppContent() {
|
||||
const { t } = useTranslation();
|
||||
const { t, i18n } = useTranslation();
|
||||
const { user, isAuthenticated, isLoading, setUser, setIsLoading } = useStore();
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
const storedTheme = localStorage.getItem('theme') || 'light';
|
||||
document.documentElement.setAttribute('data-theme', storedTheme);
|
||||
|
||||
const storedLocale = localStorage.getItem('locale');
|
||||
if (storedLocale && storedLocale !== i18n.language) {
|
||||
i18n.changeLanguage(storedLocale);
|
||||
}
|
||||
|
||||
checkAuth();
|
||||
}, []);
|
||||
|
||||
@@ -61,6 +70,7 @@ function AppContent() {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="/adminpanel" element={<AdminPanel />} />
|
||||
<Route path="/profile" element={<Profile />} />
|
||||
<Route path="*" element={<NoFamily />} />
|
||||
</Routes>
|
||||
);
|
||||
@@ -70,6 +80,7 @@ function AppContent() {
|
||||
<Routes>
|
||||
<Route path="/" element={<Navigate to={`/family/${user.family_id}`} replace />} />
|
||||
<Route path="/family/:familyId" element={<FamilyView />} />
|
||||
<Route path="/profile" element={<Profile />} />
|
||||
<Route path="/adminpanel" element={<AdminPanel />} />
|
||||
<Route path="*" element={<Navigate to={`/family/${user.family_id}`} replace />} />
|
||||
</Routes>
|
||||
|
||||
Reference in New Issue
Block a user