UNPKG

cluedin-widget

Version:

This is the project for creating and managing widgets in CluedIn.

29 lines (27 loc) 1.01 kB
const constants = require( '../constants' ); const initialState = { genericLastTasks: [], isFetchingGenericTasks: false, isFakeGenericTasks: false, nextPageNumber: 1 }; module.exports = function update( state = initialState, action = {} ) { switch( action.type ) { case constants.task.RECEIVE_GENERIC_LAST_TASKS: return Object.assign( {}, { genericLastTasks: state.genericLastTasks.concat( action.data.tasks ), isFetchingGenericTasks: false, isFakeGenericTasks: action.data.isFake, nextPageNumber: action.data.nextPage } ); case constants.task.REQUEST_GENERIC_LAST_TASKS: return Object.assign( {}, { genericLastTasks: state.genericLastTasks, isFetchingGenericTasks: true, isFakeGenericTasks: false, nextPageNumber: state.nextPageNumber } ); default : return state; } };