@truedat/dd 4.43.4 → 4.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +6 -6
  3. package/src/api/fragments.js +10 -0
  4. package/src/api/mutations.js +28 -0
  5. package/src/api/queries.js +20 -0
  6. package/src/api.js +0 -4
  7. package/src/components/DictionaryRoutes.js +2 -10
  8. package/src/components/LinkStructureTagForm.js +2 -2
  9. package/src/components/LinkedStructureTag.js +16 -7
  10. package/src/components/StructureLinkTagButton.js +8 -11
  11. package/src/components/StructureSummary.js +1 -1
  12. package/src/components/StructureTag.js +59 -20
  13. package/src/components/StructureTagForm.js +30 -35
  14. package/src/components/StructureTags.js +7 -6
  15. package/src/components/StructureTagsCards.js +56 -59
  16. package/src/components/StructureTagsCrumbs.js +4 -4
  17. package/src/components/StructureTagsRoutes.js +33 -57
  18. package/src/components/StructuresRoutes.js +0 -3
  19. package/src/components/TagsHeader.js +14 -21
  20. package/src/components/__tests__/PendingStructureNoteRow.spec.js +5 -1
  21. package/src/components/__tests__/PendingStructureNotes.spec.js +2 -2
  22. package/src/components/__tests__/StructureTag.spec.js +4 -1
  23. package/src/components/__tests__/StructureTagForm.spec.js +40 -82
  24. package/src/components/__tests__/StructureTags.spec.js +7 -7
  25. package/src/components/__tests__/StructureTagsCards.spec.js +38 -36
  26. package/src/components/__tests__/StructuresUploadEventsTable.spec.js +36 -42
  27. package/src/components/__tests__/__snapshots__/DictionaryRoutes.spec.js.snap +3 -3
  28. package/src/components/__tests__/__snapshots__/PendingStructureNoteRow.spec.js.snap +33 -29
  29. package/src/components/__tests__/__snapshots__/StructureTag.spec.js.snap +13 -2
  30. package/src/components/__tests__/__snapshots__/StructureTagForm.spec.js.snap +7 -56
  31. package/src/components/__tests__/__snapshots__/StructureTags.spec.js.snap +32 -44
  32. package/src/components/__tests__/__snapshots__/StructureTagsCards.spec.js.snap +53 -118
  33. package/src/components/__tests__/__snapshots__/StructureTagsCrumbs.spec.js.snap +1 -1
  34. package/src/components/__tests__/__snapshots__/StructureTypes.spec.js.snap +1 -1
  35. package/src/components/__tests__/__snapshots__/StructureTypesCrumbs.spec.js.snap +1 -1
  36. package/src/components/__tests__/__snapshots__/StructureTypesTable.spec.js.snap +2 -2
  37. package/src/messages/en.js +4 -2
  38. package/src/messages/es.js +8 -4
  39. package/src/reducers/__tests__/editableStructureTags.spec.js +39 -0
  40. package/src/reducers/__tests__/structureTagsSaving.spec.js +40 -0
  41. package/src/reducers/__tests__/structuresUploadEventsLoading.spec.js +18 -4
  42. package/src/reducers/ddMessage.js +8 -9
  43. package/src/reducers/editableStructureTags.js +19 -0
  44. package/src/reducers/index.js +4 -9
  45. package/src/reducers/structureTagSaving.js +18 -0
  46. package/src/routines.js +3 -5
  47. package/src/sagas/__tests__/createStructureTag.spec.js +28 -13
  48. package/src/sagas/__tests__/deleteStructureTag.spec.js +27 -15
  49. package/src/sagas/__tests__/updateStructureTag.spec.js +26 -13
  50. package/src/sagas/createStructureTag.js +15 -13
  51. package/src/sagas/deleteStructureTag.js +13 -8
  52. package/src/sagas/index.js +0 -6
  53. package/src/sagas/updateStructureTag.js +8 -15
  54. package/src/selectors/__tests__/getStructuresUploadEventColumns.spec.js +1 -1
  55. package/src/components/StructureTagLoader.js +0 -28
  56. package/src/components/StructureTagsLoader.js +0 -26
  57. package/src/components/__tests__/StructureTagLoader.spec.js +0 -29
  58. package/src/components/__tests__/StructureTagsLoader.spec.js +0 -24
  59. package/src/components/__tests__/__snapshots__/StructureTagLoader.spec.js.snap +0 -3
  60. package/src/components/__tests__/__snapshots__/StructureTagsLoader.spec.js.snap +0 -3
  61. package/src/reducers/__tests__/structureTag.spec.js +0 -80
  62. package/src/reducers/__tests__/structureTagLoading.spec.js +0 -40
  63. package/src/reducers/__tests__/structureTags.spec.js +0 -32
  64. package/src/reducers/__tests__/structureTagsLoading.spec.js +0 -40
  65. package/src/reducers/structureTag.js +0 -38
  66. package/src/reducers/structureTagLoading.js +0 -16
  67. package/src/reducers/structureTags.js +0 -19
  68. package/src/reducers/structureTagsLoading.js +0 -16
  69. package/src/sagas/__tests__/deleteStructureType.spec.js +0 -70
  70. package/src/sagas/__tests__/fetchStructureTag.spec.js +0 -74
  71. package/src/sagas/__tests__/fetchStructureTags.spec.js +0 -72
  72. package/src/sagas/fetchStructureTag.js +0 -29
  73. package/src/sagas/fetchStructureTags.js +0 -25
@@ -1,24 +0,0 @@
1
- import React from "react";
2
- import { shallow, mount } from "enzyme";
3
- import { StructureTagsLoader } from "../StructureTagsLoader";
4
-
5
- describe("<StructureTagsLoader />", () => {
6
- it("matches the latest snapshot", () => {
7
- const fetchStructureTags = jest.fn();
8
- const props = { fetchStructureTags };
9
- const wrapper = shallow(<StructureTagsLoader {...props} />);
10
- expect(wrapper).toMatchSnapshot();
11
- });
12
-
13
- it("calls fetchStructureTags when component mounts, clearStructureTags when component unmounts", () => {
14
- const fetchStructureTags = jest.fn();
15
- const clearStructureTags = jest.fn();
16
- const props = { fetchStructureTags, clearStructureTags };
17
- const wrapper = mount(<StructureTagsLoader {...props} />);
18
- expect(clearStructureTags.mock.calls.length).toBe(0);
19
- expect(fetchStructureTags.mock.calls.length).toBe(1);
20
- wrapper.unmount();
21
- expect(clearStructureTags.mock.calls.length).toBe(1);
22
- expect(fetchStructureTags.mock.calls.length).toBe(1);
23
- });
24
- });
@@ -1,3 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<StructureTagLoader /> matches the latest snapshot 1`] = `""`;
@@ -1,3 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<StructureTagsLoader /> matches the latest snapshot 1`] = `""`;
@@ -1,80 +0,0 @@
1
- import {
2
- fetchStructureTag,
3
- clearStructureTag,
4
- createStructureTag
5
- } from "../../routines";
6
- import { structureTag, structureTagCreating } from "..";
7
-
8
- const fooState = { foo: "bar" };
9
-
10
- describe("reducers: structureTag", () => {
11
- const initialState = {};
12
-
13
- it("should provide the initial state", () => {
14
- expect(structureTag(undefined, {})).toEqual(initialState);
15
- });
16
-
17
- it("should handle the fetchStructureTag.SUCCESS action", () => {
18
- const data = {
19
- id: 1,
20
- structure_type: "doc",
21
- template_id: 1,
22
- translation: null
23
- };
24
-
25
- expect(
26
- structureTag(fooState, {
27
- type: fetchStructureTag.SUCCESS,
28
- payload: { data }
29
- })
30
- ).toMatchObject(data);
31
- });
32
-
33
- it("should handle the clearStructureTag.TRIGGER action", () => {
34
- expect(
35
- structureTag(fooState, {
36
- type: clearStructureTag.TRIGGER
37
- })
38
- ).toMatchObject({});
39
- });
40
-
41
- it("should ignore unknown actions", () => {
42
- expect(structureTag(fooState, { type: "FOO" })).toBe(fooState);
43
- });
44
- });
45
-
46
- describe("reducers: structureTagCreating", () => {
47
- const initialState = false;
48
-
49
- it("should provide the initial state", () => {
50
- expect(structureTagCreating(undefined, {})).toBe(initialState);
51
- });
52
-
53
- it("should handle the createStructureTag.TRIGGER action", () => {
54
- expect(
55
- structureTagCreating(fooState, {
56
- type: createStructureTag.TRIGGER
57
- })
58
- ).toBe(true);
59
- });
60
-
61
- it("should handle the createStructureTag.SUCCESS action", () => {
62
- expect(
63
- structureTagCreating(fooState, {
64
- type: createStructureTag.SUCCESS
65
- })
66
- ).toBe(false);
67
- });
68
-
69
- it("should handle the createStructureTag.FAILURE action", () => {
70
- expect(
71
- structureTagCreating(fooState, {
72
- type: createStructureTag.FAILURE
73
- })
74
- ).toBe(false);
75
- });
76
-
77
- it("should ignore unknown actions", () => {
78
- expect(structureTagCreating(fooState, { type: "FOO" })).toBe(fooState);
79
- });
80
- });
@@ -1,40 +0,0 @@
1
- import { fetchStructureTags } from "../../routines";
2
- import { structureTagsLoading } from "..";
3
-
4
- const fooState = { foo: "bar" };
5
-
6
- describe("reducers: structureTagsLoading", () => {
7
- const initialState = false;
8
-
9
- it("should provide the initial state", () => {
10
- expect(structureTagsLoading(undefined, {})).toBe(initialState);
11
- });
12
-
13
- it("should handle the fetchStructureTags.TRIGGER action", () => {
14
- expect(
15
- structureTagsLoading(fooState, {
16
- type: fetchStructureTags.TRIGGER
17
- })
18
- ).toBe(true);
19
- });
20
-
21
- it("should handle the fetchStructureTags.FULFILL action", () => {
22
- expect(
23
- structureTagsLoading(fooState, {
24
- type: fetchStructureTags.FULFILL
25
- })
26
- ).toBe(false);
27
- });
28
-
29
- it("should handle the fetchStructureTags.FAILURE action", () => {
30
- expect(
31
- structureTagsLoading(fooState, {
32
- type: fetchStructureTags.FAILURE
33
- })
34
- ).toBe(false);
35
- });
36
-
37
- it("should ignore unknown actions", () => {
38
- expect(structureTagsLoading(fooState, { type: "FOO" })).toBe(fooState);
39
- });
40
- });
@@ -1,32 +0,0 @@
1
- import { fetchStructureTags } from "../../routines";
2
- import { structureTags } from "..";
3
-
4
- const fooState = [{ foo: "bar" }];
5
-
6
- describe("reducers: structureTags", () => {
7
- const initialState = [];
8
-
9
- it("should provide the initial state", () => {
10
- expect(structureTags(undefined, {})).toEqual(initialState);
11
- });
12
-
13
- it("should handle the fetchStructureTags.SUCCESS action", () => {
14
- const someStructureTags = [
15
- { id: 1, name: "TAG 1" },
16
- { id: 2, name: "TAG 2" }
17
- ];
18
-
19
- const payload = { data: someStructureTags };
20
-
21
- expect(
22
- structureTags(fooState, {
23
- type: fetchStructureTags.SUCCESS,
24
- payload
25
- })
26
- ).toMatchObject(someStructureTags);
27
- });
28
-
29
- it("should ignore unknown actions", () => {
30
- expect(structureTags(fooState, { type: "FOO" })).toBe(fooState);
31
- });
32
- });
@@ -1,40 +0,0 @@
1
- import { fetchStructureTag } from "../../routines";
2
- import { structureTagLoading } from "..";
3
-
4
- const fooState = { foo: "bar" };
5
-
6
- describe("reducers: structureTagLoading", () => {
7
- const initialState = false;
8
-
9
- it("should provide the initial state", () => {
10
- expect(structureTagLoading(undefined, {})).toBe(initialState);
11
- });
12
-
13
- it("should handle the fetchStructureTag.TRIGGER action", () => {
14
- expect(
15
- structureTagLoading(fooState, {
16
- type: fetchStructureTag.TRIGGER
17
- })
18
- ).toBe(true);
19
- });
20
-
21
- it("should handle the fetchStructureTag.FULFILL action", () => {
22
- expect(
23
- structureTagLoading(fooState, {
24
- type: fetchStructureTag.FULFILL
25
- })
26
- ).toBe(false);
27
- });
28
-
29
- it("should handle the fetchStructureTag.FAILURE action", () => {
30
- expect(
31
- structureTagLoading(fooState, {
32
- type: fetchStructureTag.FAILURE
33
- })
34
- ).toBe(false);
35
- });
36
-
37
- it("should ignore unknown actions", () => {
38
- expect(structureTagLoading(fooState, { type: "FOO" })).toBe(fooState);
39
- });
40
- });
@@ -1,38 +0,0 @@
1
- import _ from "lodash/fp";
2
- import {
3
- fetchStructureTag,
4
- clearStructureTag,
5
- createStructureTag
6
- } from "../routines";
7
-
8
- const initialState = {};
9
-
10
- const structureTag = (state = initialState, { type, payload }) => {
11
- switch (type) {
12
- case fetchStructureTag.TRIGGER:
13
- return initialState;
14
- case clearStructureTag.TRIGGER:
15
- return initialState;
16
- case fetchStructureTag.SUCCESS:
17
- return _.propOr({}, "data")(payload);
18
- default:
19
- return state;
20
- }
21
- };
22
-
23
- const creatingInitialState = false;
24
-
25
- const structureTagCreating = (state = creatingInitialState, { type }) => {
26
- switch (type) {
27
- case createStructureTag.TRIGGER:
28
- return true;
29
- case createStructureTag.SUCCESS:
30
- return false;
31
- case createStructureTag.FAILURE:
32
- return false;
33
- default:
34
- return state;
35
- }
36
- };
37
-
38
- export { structureTag, structureTagCreating };
@@ -1,16 +0,0 @@
1
- import { fetchStructureTag } from "../routines";
2
-
3
- const structureTagLoading = (state = false, { type }) => {
4
- switch (type) {
5
- case fetchStructureTag.TRIGGER:
6
- return true;
7
- case fetchStructureTag.FULFILL:
8
- return false;
9
- case fetchStructureTag.FAILURE:
10
- return false;
11
- default:
12
- return state;
13
- }
14
- };
15
-
16
- export { structureTagLoading };
@@ -1,19 +0,0 @@
1
- import _ from "lodash/fp";
2
- import { fetchStructureTags, clearStructureTags } from "../routines";
3
-
4
- const initialState = [];
5
-
6
- const structureTags = (state = initialState, { type, payload }) => {
7
- switch (type) {
8
- case fetchStructureTags.TRIGGER:
9
- return initialState;
10
- case clearStructureTags.TRIGGER:
11
- return initialState;
12
- case fetchStructureTags.SUCCESS:
13
- return _.propOr([], "data")(payload);
14
- default:
15
- return state;
16
- }
17
- };
18
-
19
- export { structureTags };
@@ -1,16 +0,0 @@
1
- import { fetchStructureTags } from "../routines";
2
-
3
- const structureTagsLoading = (state = false, { type }) => {
4
- switch (type) {
5
- case fetchStructureTags.TRIGGER:
6
- return true;
7
- case fetchStructureTags.FULFILL:
8
- return false;
9
- case fetchStructureTags.FAILURE:
10
- return false;
11
- default:
12
- return state;
13
- }
14
- };
15
-
16
- export { structureTagsLoading };
@@ -1,70 +0,0 @@
1
- import { compile } from "path-to-regexp";
2
- import { testSaga } from "redux-saga-test-plan";
3
- import { apiJsonDelete, JSON_OPTS } from "@truedat/core/services/api";
4
- import {
5
- deleteStructureTagSaga,
6
- deleteStructureTagRequestSaga
7
- } from "../deleteStructureTag";
8
- import { deleteStructureTag } from "../../routines";
9
- import { API_STRUCTURE_TAG } from "../../api";
10
-
11
- describe("sagas: deleteStructureTagRequestSaga", () => {
12
- it("should invoke deleteStructureTagSaga on deleteStructureTag.TRIGGER", () => {
13
- expect(() => {
14
- testSaga(deleteStructureTagRequestSaga)
15
- .next()
16
- .takeLatest(deleteStructureTag.TRIGGER, deleteStructureTagSaga)
17
- .finish()
18
- .isDone();
19
- }).not.toThrow();
20
- });
21
-
22
- it("should throw exception if an unhandled action is received", () => {
23
- expect(() => {
24
- testSaga(deleteStructureTagRequestSaga)
25
- .next()
26
- .takeLatest("FOO", deleteStructureTagRequestSaga);
27
- }).toThrow();
28
- });
29
- });
30
-
31
- describe("sagas: deleteStructureTagSaga", () => {
32
- const payload = { id: 1 };
33
- const { id } = payload;
34
- const url = compile(API_STRUCTURE_TAG)({ id });
35
-
36
- it("should put a success action when a response is returned", () => {
37
- expect(() => {
38
- testSaga(deleteStructureTagSaga, { payload })
39
- .next()
40
- .put(deleteStructureTag.request())
41
- .next()
42
- .call(apiJsonDelete, url, JSON_OPTS)
43
- .next({ data: payload })
44
- .put(deleteStructureTag.success(payload))
45
- .next()
46
- .put(deleteStructureTag.fulfill())
47
- .next()
48
- .isDone();
49
- }).not.toThrow();
50
- });
51
-
52
- it("should put a failure action when the call returns an error", () => {
53
- const message = "Request failed";
54
- const error = { message };
55
-
56
- expect(() => {
57
- testSaga(deleteStructureTagSaga, { payload })
58
- .next()
59
- .put(deleteStructureTag.request())
60
- .next()
61
- .call(apiJsonDelete, url, JSON_OPTS)
62
- .throw(error)
63
- .put(deleteStructureTag.failure(message))
64
- .next()
65
- .put(deleteStructureTag.fulfill())
66
- .next()
67
- .isDone();
68
- }).not.toThrow();
69
- });
70
- });
@@ -1,74 +0,0 @@
1
- import { compile } from "path-to-regexp";
2
- import { testSaga } from "redux-saga-test-plan";
3
- import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
4
- import {
5
- fetchStructureTagRequestSaga,
6
- fetchStructureTagSaga
7
- } from "../fetchStructureTag";
8
- import { fetchStructureTag } from "../../routines";
9
- import { API_STRUCTURE_TAG } from "../../api";
10
-
11
- describe("sagas: fetchStructureTagRequestSaga", () => {
12
- it("should invoke fetchStructureTagSaga on trigger", () => {
13
- expect(() => {
14
- testSaga(fetchStructureTagRequestSaga)
15
- .next()
16
- .takeLatest(fetchStructureTag.TRIGGER, fetchStructureTagSaga)
17
- .finish()
18
- .isDone();
19
- }).not.toThrow();
20
- });
21
-
22
- it("should throw exception if an unhandled action is received", () => {
23
- expect(() => {
24
- testSaga(fetchStructureTagRequestSaga)
25
- .next()
26
- .takeLatest("FOO", fetchStructureTagSaga);
27
- }).toThrow();
28
- });
29
- });
30
-
31
- describe("sagas: fetchStructureTagSaga", () => {
32
- it("should put a success action when a response is returned", () => {
33
- const id = 1;
34
- const url = compile(API_STRUCTURE_TAG)({ id });
35
- const payload = { id };
36
- const data = { name: "tag1" };
37
-
38
- expect(() => {
39
- testSaga(fetchStructureTagSaga, { payload })
40
- .next()
41
- .put(fetchStructureTag.request())
42
- .next()
43
- .call(apiJson, url, JSON_OPTS)
44
- .next({ data })
45
- .put(fetchStructureTag.success(data))
46
- .next()
47
- .put(fetchStructureTag.fulfill())
48
- .next()
49
- .isDone();
50
- }).not.toThrow();
51
- });
52
-
53
- it("should put a failure action when the call returns an error", () => {
54
- const message = "Request failed";
55
- const error = { message };
56
- const id = 1;
57
- const url = compile(API_STRUCTURE_TAG)({ id });
58
- const payload = { id };
59
-
60
- expect(() => {
61
- testSaga(fetchStructureTagSaga, { payload })
62
- .next()
63
- .put(fetchStructureTag.request())
64
- .next()
65
- .call(apiJson, url, JSON_OPTS)
66
- .throw(error)
67
- .put(fetchStructureTag.failure(message))
68
- .next()
69
- .put(fetchStructureTag.fulfill())
70
- .next()
71
- .isDone();
72
- }).not.toThrow();
73
- });
74
- });
@@ -1,72 +0,0 @@
1
- import { testSaga } from "redux-saga-test-plan";
2
- import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
3
- import {
4
- fetchStructureTagsRequestSaga,
5
- fetchStructureTagsSaga
6
- } from "../fetchStructureTags";
7
- import { fetchStructureTags } from "../../routines";
8
- import { API_STRUCTURE_TAGS } from "../../api";
9
-
10
- describe("sagas: fetchStructureTagsRequestSaga", () => {
11
- it("should invoke fetchStructureTagsSaga on trigger", () => {
12
- expect(() => {
13
- testSaga(fetchStructureTagsRequestSaga)
14
- .next()
15
- .takeLatest(fetchStructureTags.TRIGGER, fetchStructureTagsSaga)
16
- .finish()
17
- .isDone();
18
- }).not.toThrow();
19
- });
20
-
21
- it("should throw exception if an unhandled action is received", () => {
22
- expect(() => {
23
- testSaga(fetchStructureTagsRequestSaga)
24
- .next()
25
- .takeLatest("FOO", fetchStructureTagsSaga);
26
- }).toThrow();
27
- });
28
- });
29
-
30
- describe("sagas: fetchStructureTagsSaga", () => {
31
- const data = {
32
- collection: [
33
- { id: 1, name: "TAG 1" },
34
- { id: 2, name: "TAG 2" }
35
- ]
36
- };
37
-
38
- it("should put a success action when a response is returned", () => {
39
- expect(() => {
40
- testSaga(fetchStructureTagsSaga)
41
- .next()
42
- .put(fetchStructureTags.request())
43
- .next()
44
- .call(apiJson, API_STRUCTURE_TAGS, JSON_OPTS)
45
- .next({ data })
46
- .put(fetchStructureTags.success(data))
47
- .next()
48
- .put(fetchStructureTags.fulfill())
49
- .next()
50
- .isDone();
51
- }).not.toThrow();
52
- });
53
-
54
- it("should put a failure action when the call returns an error", () => {
55
- const message = "Request failed";
56
- const error = { message };
57
-
58
- expect(() => {
59
- testSaga(fetchStructureTagsSaga)
60
- .next()
61
- .put(fetchStructureTags.request())
62
- .next()
63
- .call(apiJson, API_STRUCTURE_TAGS, JSON_OPTS)
64
- .throw(error)
65
- .put(fetchStructureTags.failure(message))
66
- .next()
67
- .put(fetchStructureTags.fulfill())
68
- .next()
69
- .isDone();
70
- }).not.toThrow();
71
- });
72
- });
@@ -1,29 +0,0 @@
1
- import { compile } from "path-to-regexp";
2
- import { call, put, takeLatest } from "redux-saga/effects";
3
- import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
4
- import { fetchStructureTag } from "../routines";
5
- import { API_STRUCTURE_TAG } from "../api";
6
-
7
- const structureTagPath = compile(API_STRUCTURE_TAG);
8
-
9
- export function* fetchStructureTagSaga({ payload }) {
10
- try {
11
- yield put(fetchStructureTag.request());
12
- const url = structureTagPath(payload);
13
- const { data } = yield call(apiJson, url, JSON_OPTS);
14
- yield put(fetchStructureTag.success(data));
15
- } catch (error) {
16
- if (error.response) {
17
- const { status, data } = error.response;
18
- yield put(fetchStructureTag.failure({ status, data }));
19
- } else {
20
- yield put(fetchStructureTag.failure(error.message));
21
- }
22
- } finally {
23
- yield put(fetchStructureTag.fulfill());
24
- }
25
- }
26
-
27
- export function* fetchStructureTagRequestSaga() {
28
- yield takeLatest(fetchStructureTag.TRIGGER, fetchStructureTagSaga);
29
- }
@@ -1,25 +0,0 @@
1
- import { call, put, takeLatest } from "redux-saga/effects";
2
- import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
3
- import { fetchStructureTags } from "../routines";
4
- import { API_STRUCTURE_TAGS } from "../api";
5
-
6
- export function* fetchStructureTagsSaga() {
7
- try {
8
- yield put(fetchStructureTags.request());
9
- const { data } = yield call(apiJson, API_STRUCTURE_TAGS, JSON_OPTS);
10
- yield put(fetchStructureTags.success(data));
11
- } catch (error) {
12
- if (error.response) {
13
- const { status, data } = error.response;
14
- yield put(fetchStructureTags.failure({ status, data }));
15
- } else {
16
- yield put(fetchStructureTags.failure(error.message));
17
- }
18
- } finally {
19
- yield put(fetchStructureTags.fulfill());
20
- }
21
- }
22
-
23
- export function* fetchStructureTagsRequestSaga() {
24
- yield takeLatest(fetchStructureTags.TRIGGER, fetchStructureTagsSaga);
25
- }