revert Merge pull request 'try to do better' (#18) from refactor/frontend-code-quality into master

Reviewed-on: http://192.168.31.100:3847/Arrelin/family_budget/pulls/18
This commit is contained in:
2026-01-29 12:38:21 +00:00
parent 30b1c97043
commit 5bcabb2736
34 changed files with 61 additions and 43 deletions

View File

@@ -5,8 +5,9 @@ import { User as UserIcon } from 'lucide-react';
import { familyApi, authApi } from '../api/client';
import { useStore } from '../store/useStore';
import { useFamilyMembers, useConfirm } from '../hooks';
import type { Theme } from '../types';
import { 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';
@@ -18,7 +19,7 @@ export default function Profile() {
const { t, i18n } = useTranslation();
const navigate = useNavigate();
const { user, selectedFamily, setSelectedFamily, setUser, preferences, setPreferences } = useStore();
const { members, loading: membersLoading } = useFamilyMembers(user?.family_id || null);
const { members, loading: membersLoading, loadMembers } = useFamilyMembers(user?.family_id || null);
const { confirmState, confirm, cancel } = useConfirm();
const [leavingFamily, setLeavingFamily] = useState(false);
@@ -60,6 +61,17 @@ 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'));