1
0
ohmyform/ui/graphql/query/form.pager.query.ts
Michael Schramm 9c4c325e5a
Switch to single branch (#221)
* remove submodules
* add api and ui files
* update github actions
* use sparse checkout
* update node setup
* update checkout
* update docker
* change permissions
* update mariadb health check
* update changelog
2023-12-02 19:22:40 +01:00

38 lines
783 B
TypeScript

import { QueryHookOptions, QueryResult, useQuery } from '@apollo/client'
import { gql } from '@apollo/client/core'
import { FORM_PAGER_FRAGMENT, FormPagerFragment } from '../fragment/form.pager.fragment'
interface Data {
pager: {
entries: FormPagerFragment[]
total: number
limit: number
start: number
}
}
interface Variables {
start?: number
limit?: number
}
const QUERY = gql`
query listForms($start: Int, $limit: Int) {
pager: listForms(start: $start, limit: $limit) {
entries {
...PagerForm
}
total
limit
start
}
}
${FORM_PAGER_FRAGMENT}
`
export const useFormPagerQuery = (
options?: QueryHookOptions<Data, Variables>
): QueryResult<Data, Variables> => useQuery<Data, Variables>(QUERY, options)