MCPcopy Create free account
hub / github.com/chartbrew/chartbrew / completeTutorial

Function completeTutorial

client/src/actions/tutorial.js:16–42  ·  view source on GitHub ↗
(tut)

Source from the content-addressed store, hash-verified

14}
15
16export function completeTutorial(tut) {
17 return (dispatch, getState) => {
18 const user = getState().user.data;
19 const { tutorial } = getState();
20 if (!user.id) throw new Error("No user found");
21
22 // if a tutorial is passed, use the argument, otherwise use current tutorial
23 const tempTour = tut ? `${tut}` : `${tutorial}`;
24 let tempTutorials = {
25 tutorials: {
26 [tempTour]: APP_VERSION,
27 },
28 };
29
30 if (user.tutorials) {
31 tempTutorials = {
32 tutorials: {
33 ...user.tutorials,
34 [tempTour]: APP_VERSION,
35 },
36 };
37 }
38
39 dispatch({ type: COMPLETE_TUTORIAL });
40 return dispatch(updateUser(user.id, tempTutorials));
41 };
42}
43
44export function resetTutorial(tuts) {
45 return (dispatch, getState) => {

Callers 2

onCloseFunction · 0.85
_onCompleteTutorialsFunction · 0.85

Calls 2

updateUserFunction · 0.90
dispatchFunction · 0.50

Tested by

no test coverage detected