-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathinteractionlogs.js
44 lines (39 loc) · 1.22 KB
/
interactionlogs.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
// @flow
import { createResource } from "@brigad/redux-rest-easy"
import { normalize, schema } from "normalizr"
import { customerManagementBackend } from "../config"
const interactionLogSchema = new schema.Entity("interactionlogs", undefined, {
idAttribute: "customerId",
})
const interactionlogs = createResource("interactionlogs")({
retrieveInteractionLog: {
method: "GET",
url: `${customerManagementBackend}/interaction-logs/:customerId`,
normalizer: data => normalize(data, interactionLogSchema),
},
acknowledgeInteractions: {
method: "PATCH",
url: `${customerManagementBackend}/interaction-logs/:customerId`,
normalizer: data => normalize(data, interactionLogSchema),
},
})
const {
actions: {
resource: { reset: resetInteractionLogs },
retrieveInteractionLog: { perform: retrieveInteractionLog },
acknowledgeInteractions: { perform: acknowledgeInteractions },
},
selectors: {
resource: { getResourceById: getInteractionLog },
retrieveInteractionLog: {
request: { isPerforming: isRetrievingInteractionLog },
},
},
} = interactionlogs
export {
retrieveInteractionLog,
isRetrievingInteractionLog,
getInteractionLog,
resetInteractionLogs,
acknowledgeInteractions,
}