personal account

This commit is contained in:
arrelin
2026-01-23 12:51:34 +03:00
parent 24bd4aade4
commit b18f69ea62
15 changed files with 688 additions and 12 deletions

View File

@@ -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>