Created Banquet Management System using Bolt and Supabase but not able to fetch data in Property Manager view #5764
Unanswered
shashankrai1983
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi can some one help me in fetching the data in view of Property Manager Dashboard.
here is the Dashboard.tsx:
import React, { useState, useEffect } from 'react';
import { DashboardStats } from './DashboardStats';
import { QuickActions } from './QuickActions';
import { RecentActivity } from './RecentActivity';
import { TaskWidget } from './TaskWidget';
import { LeadForm } from '../leads/LeadForm';
import { BookingForm } from '../bookings/BookingForm';
import { ArrowRight, Users, Building2, ChevronRight } from 'lucide-react';
import { useAdmin } from '../../contexts/AdminContext';
import { useTask } from '../../contexts/TaskContext';
import { useNavigate } from '../../hooks/useNavigate';
import { supabase } from '../../lib/supabase';
import { PropertyManagerView } from './PropertyManagerView';
interface DashboardStats {
totalLeads: number;
activeBookings: number;
}
export function Dashboard() {
const [showLeadForm, setShowLeadForm] = useState(false);
const [showBookingForm, setShowBookingForm] = useState(false);
const [stats, setStats] = useState({
totalLeads: 0,
activeBookings: 0,
});
const [managers, setManagers] = useState<any[]>([]);
const { navigate } = useNavigate();
const [loading, setLoading] = useState(false);
const { fetchTasks } = useTask();
const { isAdmin, userProfile } = useAdmin();
useEffect(() => {
fetchTasks();
}, [fetchTasks]);
useEffect(() => {
const fetchData = async () => {
try {
setLoading(true);
}, [isAdmin, userProfile?.id]);
// Render property manager view if user is a property manager
if (userProfile?.role === 'property_manager') {
return ;
}
return (
Dashboard
Logged in as: {userProfile?.email}
|
Role: {userProfile?.role || 'User'}
);
}
Beta Was this translation helpful? Give feedback.
All reactions