Redux changes and refactoring

This commit is contained in:
Scott E. Graves
2019-06-06 13:00:19 -05:00
parent defbc58c7d
commit 6502657e3c
9 changed files with 193 additions and 161 deletions

View File

@@ -0,0 +1,18 @@
import {createReducer} from "redux-starter-kit";
import {setApplicationReady} from "../actions/common_actions";
export const createCommonReducer = (platform, appPlatform, version) => {
return createReducer({
AppReady: false,
AppPlatform: appPlatform,
Platform: platform,
Version: version,
}, {
[setApplicationReady]: (state, action) => {
return {
...state,
AppReady: action.payload,
};
}
});
};

View File

@@ -16,6 +16,7 @@ const versionLookup = Constants.RELEASE_TYPES.map(k=> {
export const releaseVersionReducer = createReducer({
LocationsLookup: {},
Release: 2,
ReleaseUpgradeAvailable: false,
UpgradeAvailable: false,
UpgradeDismissed: false,
Version: -1,
@@ -42,6 +43,19 @@ export const releaseVersionReducer = createReducer({
UpgradeDismissed: action.payload,
};
},
[Actions.SET_RELEASE_DATA]: (state, action) => {
return {
...state,
LocationsLookup: action.payload.locations,
VersionLookup: action.payload.versions,
};
},
[Actions.setReleaseUpgradeAvailable]: (state, action) => {
return {
...state,
ReleaseUpgradeAvailable: action.payload,
};
},
[Actions.setUIUpgradeData]: (state, action) => {
return {
...state,