61 lines
1.8 KiB
JavaScript
Raw Normal View History

2016-06-10 00:16:01 -03:00
import auth from './auth';
import config from './config';
import integrations, * as fromIntegrations from './integrations';
import entries, * as fromEntries from './entries';
import cursors from './cursors';
import editorialWorkflow, * as fromEditorialWorkflow from './editorialWorkflow';
2016-06-10 00:16:01 -03:00
import entryDraft from './entryDraft';
import collections from './collections';
import search from './search';
import mediaLibrary from './mediaLibrary';
2016-06-10 00:16:01 -03:00
import medias, * as fromMedias from './medias';
import globalUI from './globalUI';
2016-06-10 00:16:01 -03:00
const reducers = {
auth,
config,
collections,
search,
integrations,
2016-06-10 00:16:01 -03:00
entries,
cursors,
2016-09-06 13:04:17 -03:00
editorialWorkflow,
2016-06-10 00:16:01 -03:00
entryDraft,
mediaLibrary,
medias,
globalUI,
2016-06-10 00:16:01 -03:00
};
export default reducers;
2016-09-06 13:04:17 -03:00
/*
* Selectors
*/
2016-06-10 00:16:01 -03:00
export const selectEntry = (state, collection, slug) =>
fromEntries.selectEntry(state.entries, collection, slug);
export const selectEntries = (state, collection) =>
fromEntries.selectEntries(state.entries, collection);
export const selectSearchedEntries = state => {
const searchItems = state.search.get('entryIds');
return (
searchItems &&
searchItems.map(({ collection, slug }) =>
fromEntries.selectEntry(state.entries, collection, slug),
)
);
};
export const selectUnpublishedEntry = (state, collection, slug) =>
fromEditorialWorkflow.selectUnpublishedEntry(state.editorialWorkflow, collection, slug);
2016-09-06 13:04:17 -03:00
export const selectUnpublishedEntriesByStatus = (state, status) =>
fromEditorialWorkflow.selectUnpublishedEntriesByStatus(state.editorialWorkflow, status);
2016-09-06 13:04:17 -03:00
export const selectIntegration = (state, collection, hook) =>
fromIntegrations.selectIntegration(state.integrations, collection, hook);
2017-01-10 22:23:22 -02:00
export const getAsset = (state, path) =>
fromMedias.getAsset(state.config.get('public_folder'), state.medias, path);