// redux/actions/moveAction.ts import { FETCH_MOVES } from '../constants'; import { Move } from "../../entities/Move"; import { Dispatch } from "redux"; import { API_BASE_URL } from "../../config"; export const setMoves = (moves: Move[]) => { return { type: FETCH_MOVES, payload: moves, }; } export const getMoves = () => { return async (dispatch: Dispatch) => { try { const response = await fetch(`${API_BASE_URL}/move`); const data = await response.json(); dispatch(setMoves(data)); } catch (error) { console.error(error); } } }