refactor on slugformatter

This commit is contained in:
Cássio Zen
2016-10-27 13:12:18 -02:00
parent dabf6a1be1
commit baafe0b32f
5 changed files with 42 additions and 33 deletions
src
actions
backends
reducers
valueObjects

@ -181,16 +181,10 @@ export function loadEntry(entry, collection, slug) {
const state = getState();
const backend = currentBackend(state.config);
dispatch(entryLoading(collection, slug));
let getPromise;
if (entry && entry.get('path') && entry.get('partial')) {
getPromise = backend.getEntry(entry.get('collection'), entry.get('slug'), entry.get('path'));
} else {
getPromise = backend.lookupEntry(collection, slug);
}
return getPromise
.then((loadedEntry) => {
return dispatch(entryLoaded(collection, loadedEntry));
});
return backend.getEntry(collection, slug)
.then(loadedEntry => (
dispatch(entryLoaded(collection, loadedEntry))
));
};
}