INNER CODE UNIT · JavaScript

setDefaultSearchSuggestions

ujjavaldesai07/spring-boot-react-ecommerce-app · client/src/actions/index.js:357

export const setDefaultSearchSuggestions = () => dispatch => {
    log.info(`[ACTION]: getSearchSuggestions Calling API.`)

    searchSuggestionServiceAPI.get(DEFAULT_SEARCH_SUGGESTION_API)
        .then(response => {
            dispatch({
                type: SEARCH_KEYWORD, payload: {data: JSON.parse(JSON.stringify(response.data))}
            });
        })
        .catch(err => {
            log.info(`[ACTION]: unable to fetch response for API = ${DEFAULT_SEARCH_SUGGESTION_API}`)
            dispatch({type: SEARCH_KEYWORD_ERROR});
        });
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…