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 | 5x 4x 4x 4x 1x 1x | 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({
url: `https://api.tenor.com/v2/search_suggestions?q=${
getState().form.input
}&key=${getState().settings.apikey}`,
method: 'get',
})
.then(response => {
dispatch(saveSuggestions(response.data.results));
})
.catch();
|