UNPKG

@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

29 lines (28 loc) 1.01 kB
var _a; import { createSlice } from '@reduxjs/toolkit'; import { ReducerType } from './types'; var initialState = { hasOrder: false, isIdle: false, isDebug: false }; var idleSlice = createSlice({ name: 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; } } }); export var resetIdleState = (_a = idleSlice.actions, _a.resetIdleState), setHasOrder = _a.setHasOrder, setIsIdle = _a.setIsIdle, setIsDebug = _a.setIsDebug; export var selectIdleState = function (state) { return state.idle; }; export var selectIsDebug = function (state) { return state.idle.isDebug; }; export var idleReducer = idleSlice.reducer;