cluedin-widget
Version:
This is the project for creating and managing widgets in CluedIn.
26 lines (24 loc) • 843 B
JavaScript
const constants = require( '../constants' );
const initialState = {
genericLastTasks: [],
isFetchingGenericTasks: false,
isFakeGenericTasks: false
};
module.exports = function update( state = initialState, action = {} ) {
switch( action.type ) {
case constants.task.RECEIVE_GENERIC_LAST_TASKS:
return Object.assign( {}, {
genericLastTasks: action.data.tasks,
isFetchingGenericTasks: false,
isFakeGenericTasks: action.data.isFake
} );
case constants.task.REQUEST_GENERIC_LAST_TASKS:
return Object.assign( {}, {
genericLastTasks: state.genericLastTasks,
isFetchingGenericTasks: true,
isFakeGenericTasks: false
} );
default :
return state;
}
};