index.js 348 B

123456789101112131415161718192021
  1. import axios from 'axios'
  2. const getCat = () => {
  3. return axios.get('https://aws.random.cat/meow').then(res => {
  4. return { imageSrc: res.data.file }
  5. })
  6. }
  7. const getDog = () => {
  8. return { data: 'dog' }
  9. }
  10. const getGoat = () => {
  11. return Promise.resolve({ data: 'goat' })
  12. }
  13. export default {
  14. getDog,
  15. getCat,
  16. getGoat
  17. }