Api.ts 434 B

12345678910111213141516
  1. import Axios from 'axios';
  2. import { Fish, Insect } from 'types';
  3. const API = process.env.REACT_APP_API || '';
  4. export const getFishes = (): Promise<Fish[]> => Axios.get(`${API}/data/fishes.json`).then(result => result.data);
  5. export const getInsects = (): Promise<Insect[]> => Axios.get(`${API}/data/insects.json`).then(result => result.data);
  6. export const IMG = `${API}/images`;
  7. export default {
  8. getFishes,
  9. getInsects,
  10. IMG
  11. }