32 lines
777 B
TypeScript
32 lines
777 B
TypeScript
import { gql, useQuery } from '@apollo/client';
|
|
import { DecisionSupportFile } from '../../types/decision';
|
|
import { useState, useEffect } from 'react';
|
|
import { useGraphQLData } from './helper';
|
|
|
|
export const QUERY_DECISIONS = gql`
|
|
query decisions($filter: DecisionFilter) {
|
|
decisions(filter: $filter) {
|
|
id,
|
|
title,
|
|
sections
|
|
createdAt,
|
|
closedAt,
|
|
votedAt,
|
|
workgroup {
|
|
id,
|
|
name
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export function useDecisionsQuery(options = {}) {
|
|
return useQuery(QUERY_DECISIONS, options);
|
|
}
|
|
|
|
export function useDecisions(options = {}) {
|
|
const { data, loading, error } = useGraphQLData<DecisionSupportFile[]>(
|
|
QUERY_DECISIONS, 'decisions', [], options
|
|
);
|
|
return { decisions: data, loading, error };
|
|
} |