-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathReactQuery_Utils.res
59 lines (51 loc) · 1.54 KB
/
ReactQuery_Utils.res
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
49
50
51
52
53
54
55
56
57
58
59
let retry: ReactQuery_Types.retryParam<'error> => ReactQuery_Types.retryValue<'error> = value =>
switch value {
| #bool(value) => Obj.magic(value)
| #number(value) => Obj.magic(value)
| #fn(value) => Obj.magic(value)
}
let retryDelay: ReactQuery_Types.retryDelayParam<'error> => ReactQuery_Types.retryDelayValue<
'error,
> = value =>
switch value {
| #number(value) => Obj.magic(value)
| #fn(value) => Obj.magic(value)
}
let time: ReactQuery_Types.time => ReactQuery_Types.timeValue = value =>
switch value {
| #number(value) => Obj.magic(value)
| #infinity => Obj.magic(infinity)
}
let refetchInterval = value =>
switch value {
| #bool(value) => Obj.magic(value)
| #number(value) => Obj.magic(value)
}
let boolOrAlways = value =>
switch value {
| #bool(value) => Obj.magic(value)
| #always => Obj.magic(#always)
}
let notifyOnChangeProps = value =>
switch value {
| #array(value) => Obj.magic(value)
| #tracked => Obj.magic(#tracked)
}
let setQueryData: ReactQuery_Types.queryDataKeyOrFilter<
'queryKey,
> => ReactQuery_Types.queryDataKeyOrFilter<'queryKey> = value =>
switch value {
| #keys(value) => Obj.magic(value)
| #filters(value) => Obj.magic(value)
}
let placeholderData: ReactQuery_Types.placeholderData<
'queryData,
'queryResult,
> => ReactQuery_Types.placeholderDataValue = value =>
switch value {
| #data(data) => Obj.magic(data)
| #function(value) => Obj.magic(value)
}
let refetchOnMount = boolOrAlways
let refetchOnWindowFocus = boolOrAlways
let refetchOnReconnect = boolOrAlways