How to use the flux/constants/actions-constants.SEARCH_START function in flux

To help you get started, we’ve selected a few flux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mistadikay / flux-http-example / src / flux / stores / search-store.js View on Github external
function(action) {
        switch (action.actionType) {

            case actionsConstants.SEARCH_START:
                SearchStore.emit(actionsConstants.SEARCH_START);
                break;

            case actionsConstants.SEARCH_RESULTS:
                searchResults = action.results;
                searchError = null;
                SearchStore.emit(actionsConstants.SEARCH_RESULTS);
                break;

            case actionsConstants.SEARCH_ERROR:
                searchResults = null;
                searchError = action.error;
                SearchStore.emit(actionsConstants.SEARCH_ERROR);
                break;
            default:
            // no op
github mistadikay / flux-http-example / src / flux / stores / search-store.js View on Github external
function(action) {
        switch (action.actionType) {

            case actionsConstants.SEARCH_START:
                SearchStore.emit(actionsConstants.SEARCH_START);
                break;

            case actionsConstants.SEARCH_RESULTS:
                searchResults = action.results;
                searchError = null;
                SearchStore.emit(actionsConstants.SEARCH_RESULTS);
                break;

            case actionsConstants.SEARCH_ERROR:
                searchResults = null;
                searchError = action.error;
                SearchStore.emit(actionsConstants.SEARCH_ERROR);
                break;
            default:
            // no op
        }
github mistadikay / flux-http-example / src / flux / actions / search-actions.js View on Github external
search: function(query) {
        if (!isSearching) {
            isSearching = true;
            dispatcher.dispatch({
                actionType: actionsConstants.SEARCH_START
            });
            api.search(query)
                .then(
                    function(result) {
                        dispatcher.dispatch({
                            actionType: actionsConstants.SEARCH_RESULTS,
                            results: result
                        });
                        isSearching = false;
                    },
                    function(error) {
                        dispatcher.dispatch({
                            actionType: actionsConstants.SEARCH_ERROR,
                            error: error
                        });
                        isSearching = false;