Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 4x 4x 4x 4x | // @flow import axios from 'axios'; import { SET_INPUT, SAVE_SUGGESTIONS, CLEAR_SUGGESTIONS } from './types'; export const setInput = (str: string): any => ({ type: SET_INPUT, payload: str, }); export const saveSuggestions = (arr: Array<string>): any => ({ type: SAVE_SUGGESTIONS, payload: arr, }); export const clearSuggestions = () => ({ type: CLEAR_SUGGESTIONS, }); export const getSuggestions = () => ( dispatch: Function, getState: Function ) => { axios .get( `https://api.tenor.com/v1/search_suggestions?q=${ getState().form.input }&key=${getState().settings.apikey}` ) .then(response => { dispatch(saveSuggestions(response.data.results)); }) .catch(); }; |