Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit 28866c6

Browse files
committedMay 8, 2016
moving store into action creators
1 parent 37e2e70 commit 28866c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+259
-196
lines changed
 

‎lib/actions/page.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,25 @@ var test_1 = require('./test');
33
var _types_1 = require('./_types');
44
var store_1 = require('../store');
55
function pageNext() {
6-
var pagePosition = store_1.default.getState().pagePosition;
7-
var pages = store_1.default.getState().tutorial.pages;
6+
var _a = store_1.default.getState(), pagePosition = _a.pagePosition, tutorial = _a.tutorial;
7+
var pages = tutorial.pages;
88
if (pagePosition >= pages.length - 1) {
99
return { type: _types_1.ROUTE_SET, payload: { route: 'final' } };
1010
}
1111
else {
12-
pagePosition = pagePosition + 1;
12+
pagePosition += 1;
1313
setTimeout(function () { return store_1.default.dispatch(test_1.testsLoad(pagePosition)); });
14-
return { type: _types_1.PAGE_SET, payload: { pagePosition: pagePosition } };
14+
return pageSet(pagePosition);
1515
}
1616
}
1717
exports.pageNext = pageNext;
1818
function pageSet(pagePosition) {
1919
if (pagePosition === void 0) { pagePosition = 0; }
20-
var _a = store_1.default.getState(), progress = _a.progress, tutorial = _a.tutorial;
20+
var _a = store_1.default.getState(), dir = _a.dir, progress = _a.progress, tutorial = _a.tutorial;
2121
if (pagePosition >= progress.pages.length) {
22-
return {
23-
payload: { route: 'final' },
24-
type: _types_1.ROUTE_SET,
25-
};
22+
return { type: _types_1.ROUTE_SET, payload: { route: 'final' } };
2623
}
27-
return { type: _types_1.PAGE_SET, payload: { pagePosition: pagePosition, tutorial: tutorial } };
24+
return { type: _types_1.PAGE_SET, payload: { dir: dir, pagePosition: pagePosition, tutorial: tutorial, progress: progress } };
2825
}
2926
exports.pageSet = pageSet;
3027
function pagePositionLoad() {

‎lib/actions/progress.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ function progressLoad() {
99
}
1010
exports.progressLoad = progressLoad;
1111
function completePage() {
12-
var _a = store_1.default.getState(), pagePosition = _a.pagePosition, progress = _a.progress;
12+
var _a = store_1.default.getState(), pagePosition = _a.pagePosition, progress = _a.progress, tutorial = _a.tutorial;
1313
if (progress.pages.every(function (x) { return x.completed; })) {
1414
store_1.default.dispatch(completeTutorial());
1515
}
16-
return { type: _types_1.COMPLETE_PAGE, payload: { pagePosition: pagePosition } };
16+
return { type: _types_1.COMPLETE_PAGE, payload: { pagePosition: pagePosition, tutorial: tutorial } };
1717
}
1818
exports.completePage = completePage;
1919
function completeTutorial() {
20-
return { type: _types_1.COMPLETE_TUTORIAL };
20+
var tutorial = store_1.default.getState().tutorial;
21+
return { type: _types_1.COMPLETE_TUTORIAL, payload: { tutorial: tutorial } };
2122
}
2223
exports.completeTutorial = completeTutorial;

0 commit comments

Comments
 (0)