try to do better

This commit is contained in:
arrelin
2026-01-29 15:32:22 +03:00
parent 24f04a7e82
commit b88eb4a9e3
34 changed files with 43 additions and 61 deletions

View File

@@ -5,9 +5,8 @@ import { User as UserIcon } from 'lucide-react';
import { familyApi, authApi } from '../api/client';
import { useStore } from '../store/useStore';
import { useFamilyMembers, useConfirm } from '../hooks';
import { Theme } from '../types';
import type { Theme } from '../types';
import { ProfileHeader } from '../components/profile/ProfileHeader';
import { UserInfo } from '../components/profile/UserInfo';
import { FamilySection } from '../components/profile/FamilySection';
import { MembersSection } from '../components/profile/MembersSection';
import { SettingsSection } from '../components/profile/SettingsSection';
@@ -19,7 +18,7 @@ export default function Profile() {
const { t, i18n } = useTranslation();
const navigate = useNavigate();
const { user, selectedFamily, setSelectedFamily, setUser, preferences, setPreferences } = useStore();
const { members, loading: membersLoading, loadMembers } = useFamilyMembers(user?.family_id || null);
const { members, loading: membersLoading } = useFamilyMembers(user?.family_id || null);
const { confirmState, confirm, cancel } = useConfirm();
const [leavingFamily, setLeavingFamily] = useState(false);
@@ -61,17 +60,6 @@ export default function Profile() {
}
};
const handleLogout = async () => {
try {
await authApi.logout();
setUser(null);
setSelectedFamily(null);
navigate('/login');
} catch (error) {
showErrorToast(error);
}
};
const handleThemeChange = (theme: Theme) => {
setPreferences({ ...preferences, theme });
showToast.success(t('profile.themeChanged'));