selectedPropertyId bug fix
This commit is contained in:
parent
b41d761904
commit
2e16450e22
|
|
@ -188,7 +188,10 @@ export interface DashboardPayload {
|
|||
heatmap: { roomId: string; state: "vacant" | "not_ready" | "occupied" | "unavailable" }[];
|
||||
revenueExtras: { label: string; current: number; target: number }[];
|
||||
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 {
|
||||
FRONT_DESK = "FRONT_DESK",
|
||||
|
|
@ -213,9 +216,3 @@ export interface StaffAccess {
|
|||
};
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface DashboardPayload {
|
||||
recentBookings: Booking[];
|
||||
calendarEvents: { id: string; title: string; date: string; accent: "sky" | "pink" | "violet" }[];
|
||||
codeStats: { discountRedemptions: number; referralRedemptions: number };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useAuthStore } from "@/store/authStore";
|
||||
import {
|
||||
Bar,
|
||||
BarChart,
|
||||
|
|
@ -29,6 +30,8 @@ export function VisitsPage() {
|
|||
>([]);
|
||||
const [recent, setRecent] = useState<SiteVisit[]>([]);
|
||||
|
||||
const selectedPropertyId = useAuthStore((s) => s.selectedPropertyId);
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
const v = await apiGet<{
|
||||
series: Array<{ date: string; count: number }>;
|
||||
|
|
@ -40,11 +43,11 @@ export function VisitsPage() {
|
|||
})).slice(-21));
|
||||
const r = await apiGet<{ data: SiteVisit[] }>("/analytics/visits/recent");
|
||||
setRecent(r.data);
|
||||
}, []);
|
||||
}, [selectedPropertyId]);
|
||||
|
||||
useEffect(() => {
|
||||
refresh();
|
||||
}, [refresh]);
|
||||
}, [refresh, selectedPropertyId]);
|
||||
|
||||
async function simulateHit() {
|
||||
await apiPost("/analytics/visits", {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user