/
EventList.js
48 lines (44 loc) · 1 KB
/
EventList.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { fetchQuery, graphql } from 'react-relay'
import { event } from '@berty/relay/utils'
import { merge } from '@berty/common/helpers'
const query = graphql`
query EventListQuery(
$filter: BertyEntityEventInput
$orderBy: String!
$orderDesc: Bool!
$count: Int32
$cursor: String
$onlyWithoutAckedAt: Enum
$onlyWithoutSeenAt: Enum
) {
...EventList
@arguments(
filter: $filter
orderBy: $orderBy
orderDesc: $orderDesc
count: $count
cursor: $cursor
onlyWithoutAckedAt: $onlyWithoutAckedAt
onlyWithoutSeenAt: $onlyWithoutSeenAt
)
}
`
export const defaultVariables = {
filter: event.default,
orderBy: 'created_at',
orderDesc: true,
count: 20,
cursor: '',
onlyWithoutAckedAt: 0,
onlyWithoutSeenAt: 0,
}
export default context => ({
graphql: query,
defaultVariables,
fetch: async variables =>
fetchQuery(
context.environment,
query,
merge([defaultVariables, variables])
),
})