mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-22 21:29:14 +00:00
Start with reducer/selector for loading entity
This commit is contained in:
parent
7a298b61f9
commit
ae826522a1
@ -119,11 +119,7 @@ function loadingEntities(state = {}, action) {
|
||||
return state;
|
||||
}
|
||||
let newState = {};
|
||||
for (let name of Object.keys(entitiesDefaultState)) {
|
||||
if (action[name] && action[name].length > 0) {
|
||||
newState[name] = action[name][0].loading || "Loading...";
|
||||
}
|
||||
}
|
||||
newState[action.type].loading = action.loading;
|
||||
return {...state, ...newState};
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import _ from 'lodash';
|
||||
import {REQUEST, SUCCESS, FAILURE, FIDDLE, FIDDLE_DEPLOY} from '../actions';
|
||||
|
||||
export function getAccounts(state) {
|
||||
return state.entities.accounts;
|
||||
@ -108,7 +109,7 @@ export function getFiddle(state) {
|
||||
return {
|
||||
data: _.last(state.entities.fiddles),
|
||||
error: _.last(state.errorEntities.fiddles),
|
||||
loading: _.last(state.loadingEntities)
|
||||
loading: state.loadingEntities[FIDDLE[REQUEST]]
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user