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 5x 1x 5x 5x | // @flow
import axios from 'axios';
import { SAVE_GIFS, CLEAR_GIFS, SET_CHOSEN } from './types';
export const saveGifs = (arr: Array<string>): Object => ({
type: SAVE_GIFS,
payload: arr,
});
export const getGifs = () => (dispatch: Function, getState: Function) => axios
.get(
`https://api.tenor.com/v2/search?q=${getState().form.input}&key=${
getState().settings.apikey
}`
)
.then(response => {
dispatch(saveGifs(response.data.results));
})
.catch();
export const clearGifs = () => ({
type: CLEAR_GIFS,
});
export const setChosen = (url: string) => ({
type: SET_CHOSEN,
payload: url,
});
|