stored xml in tutorial redux store

This commit is contained in:
Delucse
2020-09-08 14:43:30 +02:00
parent 7e0fbf1f75
commit eea893a071
7 changed files with 38 additions and 23 deletions
+11 -7
View File
@@ -6,8 +6,9 @@ export const tutorialChange = () => (dispatch) => {
});
};
export const tutorialCheck = (id, status) => (dispatch, getState) => {
export const tutorialCheck = (status) => (dispatch, getState) => {
var tutorialsStatus = getState().tutorial.status;
var id = getState().tutorial.currentId;
tutorialsStatus[id] = {...tutorialsStatus[id], status: status};
dispatch({
type: status === 'success' ? TUTORIAL_SUCCESS : TUTORIAL_ERROR,
@@ -16,13 +17,16 @@ export const tutorialCheck = (id, status) => (dispatch, getState) => {
dispatch(tutorialChange());
};
export const storeTutorialXml = (id) => (dispatch, getState) => {
export const storeTutorialXml = (code) => (dispatch, getState) => {
var tutorialsStatus = getState().tutorial.status;
tutorialsStatus[id] = {...tutorialsStatus[id]};
dispatch({
type: TUTORIAL_XML,
payload: tutorialsStatus
});
var id = getState().tutorial.currentId;
if(id){
tutorialsStatus[id] = {...tutorialsStatus[id], xml: code};
dispatch({
type: TUTORIAL_XML,
payload: tutorialsStatus
});
}
};
export const tutorialId = (id) => (dispatch) => {