@coorpacademy/app-review 0.7.7-alpha.13 → 0.7.7-alpha.3
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.
- package/es/actions/api/post-progression.js +0 -2
- package/es/index.js +1 -1
- package/es/views/skills/index.d.ts +23 -3
- package/es/views/skills/index.js +11 -15
- package/es/views/slides/index.js +6 -16
- package/lib/actions/api/post-progression.js +0 -2
- package/lib/index.js +1 -1
- package/lib/views/skills/index.d.ts +23 -3
- package/lib/views/skills/index.js +11 -15
- package/lib/views/slides/index.js +6 -16
- package/locales/en/review.json +12 -8
- package/package.json +4 -4
- package/es/actions/api/fetch-skill.d.ts +0 -11
- package/es/actions/api/fetch-skill.js +0 -16
- package/lib/actions/api/fetch-skill.d.ts +0 -11
- package/lib/actions/api/fetch-skill.js +0 -23
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import buildTask from '@coorpacademy/redux-task';
|
|
2
2
|
import get from 'lodash/fp/get';
|
|
3
3
|
import { fetchSlide } from './fetch-slide';
|
|
4
|
-
import { fetchSkill } from './fetch-skill';
|
|
5
4
|
export const POST_PROGRESSION_REQUEST = '@@progression/POST_REQUEST';
|
|
6
5
|
export const POST_PROGRESSION_SUCCESS = '@@progression/POST_SUCCESS';
|
|
7
6
|
export const POST_PROGRESSION_FAILURE = '@@progression/POST_FAILURE';
|
|
@@ -17,6 +16,5 @@ export const postProgression = (skillRef) => async (dispatch, getState, { servic
|
|
|
17
16
|
const progression = response.payload;
|
|
18
17
|
const slideRef = progression.state.nextContent.ref;
|
|
19
18
|
await dispatch(fetchSlide(slideRef));
|
|
20
|
-
await dispatch(fetchSkill(skillRef));
|
|
21
19
|
}
|
|
22
20
|
};
|
package/es/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const ConnectedApp = (options) => {
|
|
|
15
15
|
const props = {
|
|
16
16
|
viewName: useSelector((state) => state.ui.navigation[state.ui.navigation.length - 1]),
|
|
17
17
|
slides: useSelector((state) => mapStateToSlidesProps(state, dispatch, options)),
|
|
18
|
-
skills: useSelector((state) => mapStateToSkillsProps(state
|
|
18
|
+
skills: useSelector((state) => mapStateToSkillsProps(state)),
|
|
19
19
|
navigateBack: () => dispatch(navigateBack),
|
|
20
20
|
onboarding: {}
|
|
21
21
|
};
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
import { ReviewSkillsProps } from '@coorpacademy/components/es/template/app-review/skills/prop-types';
|
|
2
1
|
import { StoreState } from '../../reducers';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
declare type SkillCard = {
|
|
3
|
+
'aria-label': string;
|
|
4
|
+
skillTitle: string;
|
|
5
|
+
skillAriaLabel: string;
|
|
6
|
+
buttonLabel: string;
|
|
7
|
+
buttonAriaLabel: string;
|
|
8
|
+
reviseLabel: string;
|
|
9
|
+
reviseAriaLabel: string;
|
|
10
|
+
isCustom: boolean;
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
};
|
|
13
|
+
declare type NoSkillsProps = {
|
|
14
|
+
iconSkillAriaLabel: string;
|
|
15
|
+
};
|
|
16
|
+
declare type SkillsProps = NoSkillsProps & {
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
title: string;
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
isLoadingAriaLabel: string;
|
|
21
|
+
listSkills: SkillCard[];
|
|
22
|
+
};
|
|
23
|
+
export { SkillsProps };
|
|
24
|
+
export declare const mapStateToSkillsProps: (state: StoreState) => SkillsProps;
|
package/es/views/skills/index.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
export const mapStateToSkillsProps = (state
|
|
2
|
-
const { translate } = options;
|
|
1
|
+
export const mapStateToSkillsProps = (state) => {
|
|
3
2
|
return {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
title: '@todo title',
|
|
4
|
+
iconSkillAriaLabel: '@todo iconSkillAriaLabel',
|
|
6
5
|
isLoading: false,
|
|
7
|
-
isLoadingAriaLabel: '
|
|
6
|
+
isLoadingAriaLabel: '@todo loading',
|
|
8
7
|
listSkills: state.data.skills.map(skill => ({
|
|
9
|
-
'aria-label':
|
|
8
|
+
'aria-label': '',
|
|
10
9
|
isCustom: skill.custom,
|
|
11
10
|
skillTitle: skill.name,
|
|
12
|
-
skillAriaLabel: skill
|
|
13
|
-
buttonLabel:
|
|
14
|
-
buttonAriaLabel:
|
|
15
|
-
reviseLabel:
|
|
16
|
-
reviseAriaLabel:
|
|
11
|
+
skillAriaLabel: '@todo skill aria label',
|
|
12
|
+
buttonLabel: '@todo button',
|
|
13
|
+
buttonAriaLabel: '@todo button aria label',
|
|
14
|
+
reviseLabel: '@todo revise',
|
|
15
|
+
reviseAriaLabel: '@todo revise aria label',
|
|
17
16
|
// eslint-disable-next-line no-console
|
|
18
17
|
onClick: () => console.log('@todo plug dispatcher select skill')
|
|
19
|
-
}))
|
|
20
|
-
titleNoSkills: translate('No skill to revise'),
|
|
21
|
-
textNoSkills: translate('Complete courses before revising'),
|
|
22
|
-
iconSkillAriaLabel: 'Image without information'
|
|
18
|
+
}))
|
|
23
19
|
};
|
|
24
20
|
};
|
package/es/views/slides/index.js
CHANGED
|
@@ -60,11 +60,7 @@ const getCurrentSlideRef = (state) => {
|
|
|
60
60
|
const content = progression.state.content;
|
|
61
61
|
return content.ref;
|
|
62
62
|
};
|
|
63
|
-
const
|
|
64
|
-
return last(slidesRef) === slideRef;
|
|
65
|
-
};
|
|
66
|
-
const buildStackSlides = (state, dispatch, options) => {
|
|
67
|
-
const { translate } = options;
|
|
63
|
+
const buildStackSlides = (state, dispatch) => {
|
|
68
64
|
const currentSlideRef = getCurrentSlideRef(state);
|
|
69
65
|
const progression = state.data.progression;
|
|
70
66
|
if (!currentSlideRef || !progression)
|
|
@@ -73,12 +69,9 @@ const buildStackSlides = (state, dispatch, options) => {
|
|
|
73
69
|
// @ts-expect-error typescript does not support capped versions of lodash functions
|
|
74
70
|
const stack = reduce.convert({ cap: false })((acc, uiSlide, _index) => {
|
|
75
71
|
const index = toInteger(_index);
|
|
76
|
-
const slideRef = slideRefs[index];
|
|
77
|
-
const lastAnsweredSlideRef = isLastSlideAnswered(progression.state.slides, slideRef);
|
|
78
72
|
const positions = state.ui.positions;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const position = lastAnsweredSlideRef && positions[index] === -1 ? 0 : positions[index];
|
|
73
|
+
const position = positions[index];
|
|
74
|
+
const slideRef = slideRefs[index];
|
|
82
75
|
if (!slideRef)
|
|
83
76
|
return set(index, { ...uiSlide, position }, acc);
|
|
84
77
|
const slideFromAPI = get(slideRef, state.data.slides);
|
|
@@ -91,7 +84,7 @@ const buildStackSlides = (state, dispatch, options) => {
|
|
|
91
84
|
const slideUI = get(['ui', 'slide', slideRef], state);
|
|
92
85
|
const animateCorrectionPopin = isCurrentSlideRef && slideUI.animateCorrectionPopin;
|
|
93
86
|
const showCorrectionPopin = isCurrentSlideRef && slideUI.showCorrectionPopin;
|
|
94
|
-
const animationType =
|
|
87
|
+
const animationType = slideUI.animationType;
|
|
95
88
|
const updatedUiSlide = {
|
|
96
89
|
...uiSlide,
|
|
97
90
|
position,
|
|
@@ -100,10 +93,7 @@ const buildStackSlides = (state, dispatch, options) => {
|
|
|
100
93
|
loading: false,
|
|
101
94
|
questionText,
|
|
102
95
|
answerUI,
|
|
103
|
-
parentContentTitle:
|
|
104
|
-
contentTitle: parentContentTitle,
|
|
105
|
-
contentType: parentContentType
|
|
106
|
-
}),
|
|
96
|
+
parentContentTitle: `From "${parentContentTitle}" ${parentContentType}`,
|
|
107
97
|
animationType
|
|
108
98
|
};
|
|
109
99
|
return set(index, updatedUiSlide, acc);
|
|
@@ -330,7 +320,7 @@ export const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
330
320
|
hiddenSteps: showCongrats
|
|
331
321
|
},
|
|
332
322
|
stack: {
|
|
333
|
-
slides: buildStackSlides(state, dispatch
|
|
323
|
+
slides: buildStackSlides(state, dispatch),
|
|
334
324
|
validateButton: {
|
|
335
325
|
label: translate('Validate'),
|
|
336
326
|
disabled: !get(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
|
@@ -7,7 +7,6 @@ exports.postProgression = exports.POST_PROGRESSION_FAILURE = exports.POST_PROGRE
|
|
|
7
7
|
const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
|
|
8
8
|
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
9
9
|
const fetch_slide_1 = require("./fetch-slide");
|
|
10
|
-
const fetch_skill_1 = require("./fetch-skill");
|
|
11
10
|
exports.POST_PROGRESSION_REQUEST = '@@progression/POST_REQUEST';
|
|
12
11
|
exports.POST_PROGRESSION_SUCCESS = '@@progression/POST_SUCCESS';
|
|
13
12
|
exports.POST_PROGRESSION_FAILURE = '@@progression/POST_FAILURE';
|
|
@@ -23,7 +22,6 @@ const postProgression = (skillRef) => async (dispatch, getState, { services }) =
|
|
|
23
22
|
const progression = response.payload;
|
|
24
23
|
const slideRef = progression.state.nextContent.ref;
|
|
25
24
|
await dispatch((0, fetch_slide_1.fetchSlide)(slideRef));
|
|
26
|
-
await dispatch((0, fetch_skill_1.fetchSkill)(skillRef));
|
|
27
25
|
}
|
|
28
26
|
};
|
|
29
27
|
exports.postProgression = postProgression;
|
package/lib/index.js
CHANGED
|
@@ -43,7 +43,7 @@ const ConnectedApp = (options) => {
|
|
|
43
43
|
const props = {
|
|
44
44
|
viewName: (0, react_redux_1.useSelector)((state) => state.ui.navigation[state.ui.navigation.length - 1]),
|
|
45
45
|
slides: (0, react_redux_1.useSelector)((state) => (0, slides_1.mapStateToSlidesProps)(state, dispatch, options)),
|
|
46
|
-
skills: (0, react_redux_1.useSelector)((state) => (0, skills_1.mapStateToSkillsProps)(state
|
|
46
|
+
skills: (0, react_redux_1.useSelector)((state) => (0, skills_1.mapStateToSkillsProps)(state)),
|
|
47
47
|
navigateBack: () => dispatch(navigation_1.navigateBack),
|
|
48
48
|
onboarding: {}
|
|
49
49
|
};
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
import { ReviewSkillsProps } from '@coorpacademy/components/es/template/app-review/skills/prop-types';
|
|
2
1
|
import { StoreState } from '../../reducers';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
declare type SkillCard = {
|
|
3
|
+
'aria-label': string;
|
|
4
|
+
skillTitle: string;
|
|
5
|
+
skillAriaLabel: string;
|
|
6
|
+
buttonLabel: string;
|
|
7
|
+
buttonAriaLabel: string;
|
|
8
|
+
reviseLabel: string;
|
|
9
|
+
reviseAriaLabel: string;
|
|
10
|
+
isCustom: boolean;
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
};
|
|
13
|
+
declare type NoSkillsProps = {
|
|
14
|
+
iconSkillAriaLabel: string;
|
|
15
|
+
};
|
|
16
|
+
declare type SkillsProps = NoSkillsProps & {
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
title: string;
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
isLoadingAriaLabel: string;
|
|
21
|
+
listSkills: SkillCard[];
|
|
22
|
+
};
|
|
23
|
+
export { SkillsProps };
|
|
24
|
+
export declare const mapStateToSkillsProps: (state: StoreState) => SkillsProps;
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapStateToSkillsProps = void 0;
|
|
4
|
-
const mapStateToSkillsProps = (state
|
|
5
|
-
const { translate } = options;
|
|
4
|
+
const mapStateToSkillsProps = (state) => {
|
|
6
5
|
return {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
title: '@todo title',
|
|
7
|
+
iconSkillAriaLabel: '@todo iconSkillAriaLabel',
|
|
9
8
|
isLoading: false,
|
|
10
|
-
isLoadingAriaLabel: '
|
|
9
|
+
isLoadingAriaLabel: '@todo loading',
|
|
11
10
|
listSkills: state.data.skills.map(skill => ({
|
|
12
|
-
'aria-label':
|
|
11
|
+
'aria-label': '',
|
|
13
12
|
isCustom: skill.custom,
|
|
14
13
|
skillTitle: skill.name,
|
|
15
|
-
skillAriaLabel: skill
|
|
16
|
-
buttonLabel:
|
|
17
|
-
buttonAriaLabel:
|
|
18
|
-
reviseLabel:
|
|
19
|
-
reviseAriaLabel:
|
|
14
|
+
skillAriaLabel: '@todo skill aria label',
|
|
15
|
+
buttonLabel: '@todo button',
|
|
16
|
+
buttonAriaLabel: '@todo button aria label',
|
|
17
|
+
reviseLabel: '@todo revise',
|
|
18
|
+
reviseAriaLabel: '@todo revise aria label',
|
|
20
19
|
// eslint-disable-next-line no-console
|
|
21
20
|
onClick: () => console.log('@todo plug dispatcher select skill')
|
|
22
|
-
}))
|
|
23
|
-
titleNoSkills: translate('No skill to revise'),
|
|
24
|
-
textNoSkills: translate('Complete courses before revising'),
|
|
25
|
-
iconSkillAriaLabel: 'Image without information'
|
|
21
|
+
}))
|
|
26
22
|
};
|
|
27
23
|
};
|
|
28
24
|
exports.mapStateToSkillsProps = mapStateToSkillsProps;
|
|
@@ -66,11 +66,7 @@ const getCurrentSlideRef = (state) => {
|
|
|
66
66
|
const content = progression.state.content;
|
|
67
67
|
return content.ref;
|
|
68
68
|
};
|
|
69
|
-
const
|
|
70
|
-
return (0, last_1.default)(slidesRef) === slideRef;
|
|
71
|
-
};
|
|
72
|
-
const buildStackSlides = (state, dispatch, options) => {
|
|
73
|
-
const { translate } = options;
|
|
69
|
+
const buildStackSlides = (state, dispatch) => {
|
|
74
70
|
const currentSlideRef = getCurrentSlideRef(state);
|
|
75
71
|
const progression = state.data.progression;
|
|
76
72
|
if (!currentSlideRef || !progression)
|
|
@@ -79,12 +75,9 @@ const buildStackSlides = (state, dispatch, options) => {
|
|
|
79
75
|
// @ts-expect-error typescript does not support capped versions of lodash functions
|
|
80
76
|
const stack = reduce_1.default.convert({ cap: false })((acc, uiSlide, _index) => {
|
|
81
77
|
const index = (0, toInteger_1.default)(_index);
|
|
82
|
-
const slideRef = slideRefs[index];
|
|
83
|
-
const lastAnsweredSlideRef = isLastSlideAnswered(progression.state.slides, slideRef);
|
|
84
78
|
const positions = state.ui.positions;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const position = lastAnsweredSlideRef && positions[index] === -1 ? 0 : positions[index];
|
|
79
|
+
const position = positions[index];
|
|
80
|
+
const slideRef = slideRefs[index];
|
|
88
81
|
if (!slideRef)
|
|
89
82
|
return (0, set_1.default)(index, { ...uiSlide, position }, acc);
|
|
90
83
|
const slideFromAPI = (0, get_1.default)(slideRef, state.data.slides);
|
|
@@ -97,7 +90,7 @@ const buildStackSlides = (state, dispatch, options) => {
|
|
|
97
90
|
const slideUI = (0, get_1.default)(['ui', 'slide', slideRef], state);
|
|
98
91
|
const animateCorrectionPopin = isCurrentSlideRef && slideUI.animateCorrectionPopin;
|
|
99
92
|
const showCorrectionPopin = isCurrentSlideRef && slideUI.showCorrectionPopin;
|
|
100
|
-
const animationType =
|
|
93
|
+
const animationType = slideUI.animationType;
|
|
101
94
|
const updatedUiSlide = {
|
|
102
95
|
...uiSlide,
|
|
103
96
|
position,
|
|
@@ -106,10 +99,7 @@ const buildStackSlides = (state, dispatch, options) => {
|
|
|
106
99
|
loading: false,
|
|
107
100
|
questionText,
|
|
108
101
|
answerUI,
|
|
109
|
-
parentContentTitle:
|
|
110
|
-
contentTitle: parentContentTitle,
|
|
111
|
-
contentType: parentContentType
|
|
112
|
-
}),
|
|
102
|
+
parentContentTitle: `From "${parentContentTitle}" ${parentContentType}`,
|
|
113
103
|
animationType
|
|
114
104
|
};
|
|
115
105
|
return (0, set_1.default)(index, updatedUiSlide, acc);
|
|
@@ -337,7 +327,7 @@ const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
337
327
|
hiddenSteps: showCongrats
|
|
338
328
|
},
|
|
339
329
|
stack: {
|
|
340
|
-
slides: buildStackSlides(state, dispatch
|
|
330
|
+
slides: buildStackSlides(state, dispatch),
|
|
341
331
|
validateButton: {
|
|
342
332
|
label: translate('Validate'),
|
|
343
333
|
disabled: !(0, get_1.default)(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
package/locales/en/review.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Review Title": "Review Mode",
|
|
3
|
-
"Content Parent Title": "From
|
|
3
|
+
"Content Parent Title": "From `{{contentTitle}}` `{{contentType}}`",
|
|
4
4
|
"Validate": "Validate",
|
|
5
5
|
"Next Question": "Next Question",
|
|
6
6
|
"KLF": "Key point",
|
|
@@ -40,11 +40,15 @@
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
"list_title": "Skills you can review",
|
|
44
|
+
"list_aria_label": "Review Skills Container",
|
|
45
|
+
"card": {
|
|
46
|
+
"aria_label": "Skill Card",
|
|
47
|
+
"text": "{{total}} questions to review",
|
|
48
|
+
"button_text": "Review this skill"
|
|
49
|
+
},
|
|
50
|
+
"no_skills": {
|
|
51
|
+
"title": "You have no skill to revise yet",
|
|
52
|
+
"text": "First you need to complete courses before you can review different skills."
|
|
53
|
+
}
|
|
50
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.7.7-alpha.
|
|
3
|
+
"version": "0.7.7-alpha.3+672627779",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"main": "lib/index.js",
|
|
36
36
|
"module": "es/index.js",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@coorpacademy/components": "10.
|
|
38
|
+
"@coorpacademy/components": "10.27.5-alpha.31+672627779",
|
|
39
39
|
"@coorpacademy/redux-task": "1.1.6",
|
|
40
40
|
"@coorpacademy/translate": "6.1.5",
|
|
41
41
|
"cross-fetch": "^3.1.5",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@coorpacademy/css-modules-require-hook": "3.0.0",
|
|
53
53
|
"@coorpacademy/eslint-plugin-coorpacademy": "^11.0.0",
|
|
54
|
-
"@coorpacademy/webpack-config": "12.0.1",
|
|
54
|
+
"@coorpacademy/webpack-config": "12.0.1-alpha.82+672627779",
|
|
55
55
|
"@testing-library/react": "^12.1.5",
|
|
56
56
|
"@types/lodash": "^4.14.182",
|
|
57
57
|
"@typescript-eslint/eslint-plugin": "^5.28.0",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"webpack-cli": "^4.10.0",
|
|
72
72
|
"webpack-dev-server": "^4.11.1"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "672627779e08919d1070239fbfe425d9353510d1"
|
|
75
75
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Dispatch } from 'redux';
|
|
2
|
-
import type { StoreState } from '../../reducers';
|
|
3
|
-
import type { Skill, ThunkOptions } from '../../types/common';
|
|
4
|
-
export declare const SKILL_FETCH_REQUEST: "@@skill/FETCH_REQUEST";
|
|
5
|
-
export declare const SKILL_FETCH_SUCCESS: "@@skill/FETCH_SUCCESS";
|
|
6
|
-
export declare const SKILL_FETCH_FAILURE: "@@skill/FETCH_FAILURE";
|
|
7
|
-
export declare type ReceivedSkill = {
|
|
8
|
-
type: typeof SKILL_FETCH_SUCCESS;
|
|
9
|
-
payload: Skill;
|
|
10
|
-
};
|
|
11
|
-
export declare const fetchSkill: (skillRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => ReceivedSkill;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import get from 'lodash/fp/get';
|
|
2
|
-
import buildTask from '@coorpacademy/redux-task';
|
|
3
|
-
export const SKILL_FETCH_REQUEST = '@@skill/FETCH_REQUEST';
|
|
4
|
-
export const SKILL_FETCH_SUCCESS = '@@skill/FETCH_SUCCESS';
|
|
5
|
-
export const SKILL_FETCH_FAILURE = '@@skill/FETCH_FAILURE';
|
|
6
|
-
export const fetchSkill = (skillRef) => (dispatch, getState, { services }) => {
|
|
7
|
-
const action = buildTask({
|
|
8
|
-
types: [SKILL_FETCH_REQUEST, SKILL_FETCH_SUCCESS, SKILL_FETCH_FAILURE],
|
|
9
|
-
task: () => {
|
|
10
|
-
const state = getState();
|
|
11
|
-
const token = get(['data', 'token'], state);
|
|
12
|
-
return services.fetchSkill(skillRef, token);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return dispatch(action);
|
|
16
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Dispatch } from 'redux';
|
|
2
|
-
import type { StoreState } from '../../reducers';
|
|
3
|
-
import type { Skill, ThunkOptions } from '../../types/common';
|
|
4
|
-
export declare const SKILL_FETCH_REQUEST: "@@skill/FETCH_REQUEST";
|
|
5
|
-
export declare const SKILL_FETCH_SUCCESS: "@@skill/FETCH_SUCCESS";
|
|
6
|
-
export declare const SKILL_FETCH_FAILURE: "@@skill/FETCH_FAILURE";
|
|
7
|
-
export declare type ReceivedSkill = {
|
|
8
|
-
type: typeof SKILL_FETCH_SUCCESS;
|
|
9
|
-
payload: Skill;
|
|
10
|
-
};
|
|
11
|
-
export declare const fetchSkill: (skillRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => ReceivedSkill;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchSkill = exports.SKILL_FETCH_FAILURE = exports.SKILL_FETCH_SUCCESS = exports.SKILL_FETCH_REQUEST = void 0;
|
|
7
|
-
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
8
|
-
const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
|
|
9
|
-
exports.SKILL_FETCH_REQUEST = '@@skill/FETCH_REQUEST';
|
|
10
|
-
exports.SKILL_FETCH_SUCCESS = '@@skill/FETCH_SUCCESS';
|
|
11
|
-
exports.SKILL_FETCH_FAILURE = '@@skill/FETCH_FAILURE';
|
|
12
|
-
const fetchSkill = (skillRef) => (dispatch, getState, { services }) => {
|
|
13
|
-
const action = (0, redux_task_1.default)({
|
|
14
|
-
types: [exports.SKILL_FETCH_REQUEST, exports.SKILL_FETCH_SUCCESS, exports.SKILL_FETCH_FAILURE],
|
|
15
|
-
task: () => {
|
|
16
|
-
const state = getState();
|
|
17
|
-
const token = (0, get_1.default)(['data', 'token'], state);
|
|
18
|
-
return services.fetchSkill(skillRef, token);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
return dispatch(action);
|
|
22
|
-
};
|
|
23
|
-
exports.fetchSkill = fetchSkill;
|