loading entity work
This commit is contained in:
parent
e53152624f
commit
83326bfd98
|
@ -119,7 +119,8 @@ function loadingEntities(state = {}, action) {
|
|||
return state;
|
||||
}
|
||||
let newState = {};
|
||||
newState[action.type].loading = action.loading;
|
||||
if(!newState[action.type]) newState[action.type] = {};
|
||||
newState[action.type].loading = action.loading || 'Loading...';
|
||||
return {...state, ...newState};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import _ from 'lodash';
|
||||
import {REQUEST, SUCCESS, FAILURE, FIDDLE, FIDDLE_DEPLOY} from '../actions';
|
||||
import {REQUEST, FIDDLE} from '../actions/index.js';
|
||||
|
||||
export function getAccounts(state) {
|
||||
return state.entities.accounts;
|
||||
|
@ -106,10 +106,11 @@ export function getMessages(state) {
|
|||
}
|
||||
|
||||
export function getFiddle(state) {
|
||||
const loadingEntity = state.loadingEntities[FIDDLE[REQUEST]];
|
||||
return {
|
||||
data: _.last(state.entities.fiddles),
|
||||
error: _.last(state.errorEntities.fiddles),
|
||||
loading: state.loadingEntities[FIDDLE[REQUEST]]
|
||||
loading: loadingEntity ? loadingEntity.loading : undefined
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue