Fix build: syntax errors, duplicate useEffects, import paths
All checks were successful
Build frontend / build (push) Successful in 1m26s
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:
@ -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');
|
||||
|
||||
Reference in New Issue
Block a user