selectedPropertyId bug fix

This commit is contained in:
brooktewabe 2026-04-06 11:47:53 +03:00
parent b41d761904
commit 2e16450e22
2 changed files with 9 additions and 9 deletions

View File

@ -188,7 +188,10 @@ export interface DashboardPayload {
heatmap: { roomId: string; state: "vacant" | "not_ready" | "occupied" | "unavailable" }[]; heatmap: { roomId: string; state: "vacant" | "not_ready" | "occupied" | "unavailable" }[];
revenueExtras: { label: string; current: number; target: number }[]; revenueExtras: { label: string; current: number; target: number }[];
rating: { score: number; label: string; imageUrl?: string }; rating: { score: number; label: string; imageUrl?: string };
}; recentBookings: Booking[];
calendarEvents: { id: string; title: string; date: string; accent: "sky" | "pink" | "violet" }[];
codeStats: { discountRedemptions: number; referralRedemptions: number };
}
export enum HotelStaffRole { export enum HotelStaffRole {
FRONT_DESK = "FRONT_DESK", FRONT_DESK = "FRONT_DESK",
@ -213,9 +216,3 @@ export interface StaffAccess {
}; };
createdAt: string; createdAt: string;
} }
export interface DashboardPayload {
recentBookings: Booking[];
calendarEvents: { id: string; title: string; date: string; accent: "sky" | "pink" | "violet" }[];
codeStats: { discountRedemptions: number; referralRedemptions: number };
}

View File

@ -1,4 +1,5 @@
import { useCallback, useEffect, useState } from "react"; import { useCallback, useEffect, useState } from "react";
import { useAuthStore } from "@/store/authStore";
import { import {
Bar, Bar,
BarChart, BarChart,
@ -29,6 +30,8 @@ export function VisitsPage() {
>([]); >([]);
const [recent, setRecent] = useState<SiteVisit[]>([]); const [recent, setRecent] = useState<SiteVisit[]>([]);
const selectedPropertyId = useAuthStore((s) => s.selectedPropertyId);
const refresh = useCallback(async () => { const refresh = useCallback(async () => {
const v = await apiGet<{ const v = await apiGet<{
series: Array<{ date: string; count: number }>; series: Array<{ date: string; count: number }>;
@ -40,11 +43,11 @@ export function VisitsPage() {
})).slice(-21)); })).slice(-21));
const r = await apiGet<{ data: SiteVisit[] }>("/analytics/visits/recent"); const r = await apiGet<{ data: SiteVisit[] }>("/analytics/visits/recent");
setRecent(r.data); setRecent(r.data);
}, []); }, [selectedPropertyId]);
useEffect(() => { useEffect(() => {
refresh(); refresh();
}, [refresh]); }, [refresh, selectedPropertyId]);
async function simulateHit() { async function simulateHit() {
await apiPost("/analytics/visits", { await apiPost("/analytics/visits", {