|
1 | 1 | "use strict"; |
2 | 2 | var _types_1 = require('./_types'); |
3 | 3 | var store_1 = require('../store'); |
4 | | -var tutorial_package_1 = require('../services/tutorial-package'); |
5 | 4 | function pageNext() { |
6 | 5 | var position = store_1.store.getState().position; |
7 | | - var nextPosition = tutorial_package_1.default.getNextPosition(position); |
8 | | - return pageSet(nextPosition); |
| 6 | + return { type: _types_1.PAGE_NEXT, payload: { position: position } }; |
9 | 7 | } |
10 | 8 | exports.pageNext = pageNext; |
11 | | -function pageSet(selectedPosition) { |
12 | | - if (selectedPosition === void 0) { selectedPosition = { chapter: 0, page: 0 }; } |
13 | | - if (selectedPosition.completed) { |
14 | | - return { type: _types_1.ROUTE_SET, payload: { route: 'final' } }; |
| 9 | +function pageSet(position) { |
| 10 | + if (position === void 0) { position = { chapter: 0, page: 0 }; } |
| 11 | + if (position.completed) { |
| 12 | + return { |
| 13 | + payload: { route: 'final' }, |
| 14 | + type: _types_1.ROUTE_SET, |
| 15 | + }; |
15 | 16 | } |
16 | | - var page = tutorial_package_1.default.getPage(selectedPosition); |
17 | | - var tasks = tutorial_package_1.default.getTasks(selectedPosition); |
18 | | - var taskTests = [].concat.apply([], tasks.map(function (task) { return task.tests || []; })); |
19 | | - var actions = tasks.map(function (task) { return task.actions || []; }); |
20 | | - return { type: _types_1.PAGE_SET, payload: { page: page, tasks: tasks, position: selectedPosition, taskTests: taskTests, actions: actions } }; |
| 17 | + return { |
| 18 | + payload: { position: position }, |
| 19 | + type: _types_1.PAGE_SET, |
| 20 | + }; |
21 | 21 | } |
22 | 22 | exports.pageSet = pageSet; |
0 commit comments