static-cms/src/actions/editor.js

23 lines
543 B
JavaScript
Raw Normal View History

import history from '../routing/history';
2016-08-11 18:21:32 -03:00
export const SWITCH_VISUAL_MODE = 'SWITCH_VISUAL_MODE';
export const CLOSED_ENTRY = 'CLOSED_ENTRY';
2016-08-11 18:21:32 -03:00
export function switchVisualMode(useVisualMode) {
return {
type: SWITCH_VISUAL_MODE,
payload: useVisualMode,
};
}
export function closeEntry(collection) {
return (dispatch) => {
if (collection && collection.get('name', false)) {
history.push(`collections/${ collection.get('name') }`);
} else {
history.goBack();
}
dispatch({ type: CLOSED_ENTRY });
2016-08-11 18:21:32 -03:00
};
}