import { handleActions } from 'utils/store' ; import { defaultWorkspaceId } from 'utils/config' ; import without from 'lodash/without' ; const KEY_WORKSPACES_ORDER = 'workspaces.order' ; const reducers = { [ KEY_WORKSPACES_ORDER ] : handleActions < typeof KEY_WORKSPACES_ORDER > ( { ADD_NEW_WORKSPACE : ( state , { payload : { id } } ) => [ ... state , id ] , REMOVE_WORKSPACE : ( state , { payload : { id } } ) => without ( state , id ) , } , [ defaultWorkspaceId ] ) , } ; export default reducers ; export const getWorkspacesIdsInOrder = ( state ) => state [ KEY_WORKSPACES_ORDER ] ;