report loadUnpublishedEntries errors

This commit is contained in:
Shawn Erquhart 2018-03-03 22:12:39 -05:00
parent 9d1ae91bc7
commit 38c7ef94cd

View File

@ -243,10 +243,17 @@ export function loadUnpublishedEntries(collections) {
if (state.config.get('publish_mode') !== EDITORIAL_WORKFLOW) return;
const backend = currentBackend(state.config);
dispatch(unpublishedEntriesLoading());
backend.unpublishedEntries(collections).then(
response => dispatch(unpublishedEntriesLoaded(response.entries, response.pagination)),
error => dispatch(unpublishedEntriesFailed(error))
);
backend.unpublishedEntries(collections)
.then(response => dispatch(unpublishedEntriesLoaded(response.entries, response.pagination)))
.catch(error => {
dispatch(notifSend({
message: `Error loading entries: ${ error }`,
kind: 'danger',
dismissAfter: 8000,
}));
dispatch(unpublishedEntriesFailed(error));
Promise.reject(error)
});
};
}