new report structure
This commit is contained in:
@@ -8,10 +8,21 @@ import {
|
||||
|
||||
import ConfigurableDashboard from "./components/Dashboard";
|
||||
import { configuration } from "./dashboard-config";
|
||||
import { useDashboardData } from "./features/dashboard";
|
||||
import {
|
||||
useReport,
|
||||
prepareReport,
|
||||
} from "./features/report";
|
||||
|
||||
export default function Dashboard() {
|
||||
const { data, isLoading, error } = useDashboardData();
|
||||
const report = useReport({
|
||||
rolling: true,
|
||||
include_transactions: true,
|
||||
group_by: ["payee"],
|
||||
})
|
||||
|
||||
const isLoading = report.isLoading;
|
||||
const error = report.error;
|
||||
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
@@ -29,10 +40,11 @@ export default function Dashboard() {
|
||||
);
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
if (!report) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const data = prepareReport(report.data?.data);
|
||||
return (
|
||||
<ConfigurableDashboard
|
||||
config={configuration}
|
||||
|
||||
Reference in New Issue
Block a user