Generating findbar commands dynamically based on config
This commit is contained in:
@ -2,8 +2,8 @@ import history from '../routing/history';
|
||||
import { SEARCH } from '../containers/FindBar';
|
||||
|
||||
export const RUN_COMMAND = 'RUN_COMMAND';
|
||||
export const LIST_POSTS = 'LIST_POSTS';
|
||||
export const LIST_FAQ = 'LIST_FAQ';
|
||||
export const SHOW_COLLECTION = 'SHOW_COLLECTION';
|
||||
export const CREATE_COLLECTION = 'CREATE_COLLECTION';
|
||||
export const HELP = 'HELP';
|
||||
|
||||
export function run(commandName, payload) {
|
||||
@ -13,11 +13,11 @@ export function run(commandName, payload) {
|
||||
export function runCommand(commandName, payload) {
|
||||
return (dispatch, getState) => {
|
||||
switch (commandName) {
|
||||
case LIST_POSTS:
|
||||
history.push('/collections/posts');
|
||||
case SHOW_COLLECTION:
|
||||
history.push(`/collections/${payload.collectionName}`);
|
||||
break;
|
||||
case LIST_FAQ:
|
||||
history.push('/collections/faq');
|
||||
case CREATE_COLLECTION:
|
||||
window.alert(`Create a new ${payload.collectionName} - not supported yet`);
|
||||
break;
|
||||
case HELP:
|
||||
window.alert('Find Bar Help (PLACEHOLDER)\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.');
|
||||
|
Reference in New Issue
Block a user