This repository has been archived on 2025-09-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
repertory-ui/src/redux/reducers/common_reducer.js
2020-02-04 12:59:58 -06:00

62 lines
1.5 KiB
JavaScript

import {createReducer} from '@reduxjs/toolkit';
import {
DISPLAY_CONFIRM_YES_NO,
notifyRebootRequired,
setAllowMount,
setApplicationReady,
setLinuxAppPlatform,
SET_DISPLAY_SELECT_APPPLATFORM
} from '../actions/common_actions';
export const createCommonReducer = (platformInfo, version) => {
return createReducer({
AllowMount: false,
AppPlatform: platformInfo.AppPlatform,
AppReady: false,
DisplayConfirmYesNo: false,
ConfirmTitle: null,
DisplaySelectAppPlatform: false,
Platform: platformInfo.Platform,
RebootRequired: false,
Version: version,
}, {
[DISPLAY_CONFIRM_YES_NO]: (state, action) => {
return {
...state,
DisplayConfirmYesNo: action.payload.show,
ConfirmTitle: action.payload.show ? action.payload.title : null,
}
},
[SET_DISPLAY_SELECT_APPPLATFORM]: (state, action) => {
return {
...state,
DisplaySelectAppPlatform: action.payload,
}
},
[setAllowMount]: (state, action) => {
return {
...state,
AllowMount: action.payload,
}
},
[setApplicationReady]: (state, action) => {
return {
...state,
AppReady: action.payload,
};
},
[setLinuxAppPlatform]: (state, action) => {
return {
...state,
AppPlatform: action.payload,
}
},
[notifyRebootRequired]: (state, action) => {
return {
...state,
RebootRequired: action.payload,
};
},
});
};