Fix build: syntax errors, duplicate useEffects, import paths
All checks were successful
Build frontend / build (push) Successful in 1m26s

- Fixed broken useEffect syntax in 4 owner pages (bookings, calendar, profits, properties)
- Removed duplicate useEffect blocks
- Fixed ClientLayout import path for AuthService (../ -> ./)
This commit is contained in:
Claw AI
2026-03-28 14:53:45 +00:00
parent 6394f1d71a
commit c2235cf575
8 changed files with 75 additions and 77 deletions

View File

@ -28,7 +28,7 @@ import {
XCircle
} from 'lucide-react';
import toast, { Toaster } from 'react-hot-toast';
import AuthService from '../../../services/AuthService';
import AuthService from '../../services/AuthService';
const StatCard = ({ title, value, change, icon: Icon, color, trend }) => {
return (
@ -234,22 +234,23 @@ export default function OwnerProfitsPage() {
const [isLoading, setIsLoading] = useState(true);
const [selectedProperty, setSelectedProperty] = useState(null);
const [dateRange, setDateRange] = useState({ start: '', end: '' });
const [selectedPeriod, setSelectedPeriod] = useState('month'); // month, year, all
const [selectedPeriod, setSelectedPeriod] = useState('month');
useEffect(() => {
const storedUser = localStorage.getItem('user');
// User loaded via AuthService
// Handled above
if (userData.role !== 'owner') {
router.push('/');
} else {
setUser(userData);
loadProfitsData();
}
useEffect(() => {
const authUser = AuthService.getUser();
if (authUser && AuthService.isOwner()) {
setUser({
name: authUser.name || authUser.email,
email: authUser.email,
role: 'owner',
});
loadData();
} else {
router.push('/auth/choose-role');
}
}, [router]);
}, [router]); // month, year, all
const loadProfitsData = () => {
const storedProfits = localStorage.getItem('ownerProfits');