mirror of
https://github.com/strapi/strapi.git
synced 2025-08-22 15:48:59 +00:00
34 lines
608 B
JavaScript
34 lines
608 B
JavaScript
/*
|
|
*
|
|
* List reducer
|
|
*
|
|
*/
|
|
|
|
import { fromJS } from 'immutable';
|
|
|
|
import { LOAD_MODELS, LOADED_MODELS, UPDATE_SCHEMA } from './constants';
|
|
|
|
const initialState = fromJS({
|
|
loading: true,
|
|
models: false,
|
|
schema: false,
|
|
});
|
|
|
|
function appReducer(state = initialState, action) {
|
|
switch (action.type) {
|
|
case LOAD_MODELS:
|
|
return state;
|
|
case LOADED_MODELS:
|
|
return state
|
|
.set('models', action.models);
|
|
case UPDATE_SCHEMA:
|
|
return state
|
|
.set('loading', false)
|
|
.set('schema', action.schema);
|
|
default:
|
|
return state;
|
|
}
|
|
}
|
|
|
|
export default appReducer;
|