Skip to content

Instantly share code, notes, and snippets.

@iammerrick
Created February 1, 2016 21:55
Show Gist options
  • Save iammerrick/5e931fcef0abf1802516 to your computer and use it in GitHub Desktop.
Save iammerrick/5e931fcef0abf1802516 to your computer and use it in GitHub Desktop.
import { selectCurrentQuery } from 'searchSelectors';
export const search = (query) => {
return (dispatch, getState) => {
dispatch({
type: UPDATE_QUERY,
payload: { query }
});
const query = selectCurrentQuery(getState());
post('/search', { query })
.then((results) => {
dispatch({
type: SEARCH_RESULTS_ARRIVED,
payload: { results }
});
});
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment