62 lines
1.5 KiB
JavaScript
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,
|
|
};
|
|
},
|
|
});
|
|
};
|