@open-tender/store
Version:
A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API
34 lines (33 loc) • 1.35 kB
JavaScript
;
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.idleReducer = exports.selectIsDebug = exports.selectIdleState = exports.setIsDebug = exports.setIsIdle = exports.setHasOrder = exports.resetIdleState = void 0;
var toolkit_1 = require("@reduxjs/toolkit");
var types_1 = require("./types");
var initialState = {
hasOrder: false,
isIdle: false,
isDebug: false
};
var idleSlice = (0, toolkit_1.createSlice)({
name: types_1.ReducerType.Idle,
initialState: initialState,
reducers: {
resetIdleState: function () { return initialState; },
setHasOrder: function (state, action) {
state.hasOrder = action.payload;
},
setIsIdle: function (state, action) {
state.isIdle = action.payload;
},
setIsDebug: function (state, action) {
state.isDebug = action.payload;
}
}
});
exports.resetIdleState = (_a = idleSlice.actions, _a.resetIdleState), exports.setHasOrder = _a.setHasOrder, exports.setIsIdle = _a.setIsIdle, exports.setIsDebug = _a.setIsDebug;
var selectIdleState = function (state) { return state.idle; };
exports.selectIdleState = selectIdleState;
var selectIsDebug = function (state) { return state.idle.isDebug; };
exports.selectIsDebug = selectIsDebug;
exports.idleReducer = idleSlice.reducer;