All files / src/form/gantt FetchUtils.ts

100% Statements 2/2
100% Branches 1/1
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22                                      4x 4x  
import { SERVER_URL } from "@config/base";
import { requestUrlAndGetPromise } from "@utils/FetchUtils";
import { GanttDomainMetaProps, GanttDomainRecord } from "./GanttComponentTypes";
 
 
export interface FetchGanttTableDataProps {
  rows: Array<GanttDomainRecord>;
  tasks: Array<GanttDomainRecord>;
  domainMetas: Record<string, GanttDomainMetaProps>;
}
 
export interface FetchListOfGanttTableDataProps {
  formId: number;
  startTimestamp: number;
  endTimestamp: number;
  useCache?: boolean;
}
 
export async function fetchListOfGanttTable(props: FetchListOfGanttTableDataProps): Promise<FetchGanttTableDataProps> {
  const { formId, useCache = false, startTimestamp, endTimestamp } = props;
  return await requestUrlAndGetPromise(`${SERVER_URL}/gantt/${formId}?startTimestamp=${startTimestamp}&endTimestamp=${endTimestamp}`, {}, { useCache });
}