mirror of
https://github.com/strapi/strapi.git
synced 2025-08-23 08:09:10 +00:00
33 lines
525 B
JavaScript
33 lines
525 B
JavaScript
![]() |
/*
|
||
|
*
|
||
|
* List reducer
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
import { fromJS } from 'immutable';
|
||
|
import {
|
||
|
LOAD_MODELS,
|
||
|
LOADED_MODELS,
|
||
|
} from './constants';
|
||
|
|
||
|
const initialState = fromJS({
|
||
|
loading: false,
|
||
|
models: {}
|
||
|
});
|
||
|
|
||
|
function appReducer(state = initialState, action) {
|
||
|
switch (action.type) {
|
||
|
case LOAD_MODELS:
|
||
|
return state
|
||
|
.set('loading', true);
|
||
|
case LOADED_MODELS:
|
||
|
return state
|
||
|
.set('loading', false)
|
||
|
.set('models', action.models);
|
||
|
default:
|
||
|
return state;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default appReducer;
|