Add timezone to report queries.

This commit is contained in:
Mike Cao 2023-08-14 22:36:18 -07:00
parent 820ad69d60
commit 29a943df9c
7 changed files with 32 additions and 6 deletions

View file

@ -1,5 +1,6 @@
import { produce } from 'immer';
import { useCallback, useEffect, useState } from 'react';
import { useTimezone } from './useTimezone';
import useApi from './useApi';
const baseParameters = {
@ -12,6 +13,7 @@ export function useReport(reportId, defaultParameters) {
const [report, setReport] = useState(null);
const [isRunning, setIsRunning] = useState(false);
const { get, post } = useApi();
const [timezone] = useTimezone();
const loadReport = async id => {
const data = await get(`/reports/${id}`);
@ -33,7 +35,7 @@ export function useReport(reportId, defaultParameters) {
const { type } = report;
const data = await post(`/reports/${type}`, parameters);
const data = await post(`/reports/${type}`, { ...parameters, timezone });
setReport(
produce(state => {