Files
model-platform/frontend/app/features/operations/reportStore.ts
T

20 lines
614 B
TypeScript

import { create } from "zustand";
import { persist } from "zustand/middleware";
import { REPORTS, type MonitoringReport } from "./reportData";
type ReportStore = {
reports: MonitoringReport[];
updateReport: (reportId: string, updates: Partial<MonitoringReport>) => void;
};
export const useReportStore = create<ReportStore>()(persist((set) => ({
reports: REPORTS,
updateReport: (reportId, updates) => set((state) => ({
reports: state.reports.map((report) => report.reportId === reportId ? { ...report, ...updates } : report),
})),
}), {
name: "a-card-operations-report-mock",
version: 1,
}));