Created
June 17, 2018 18:49
-
-
Save drenther/e6faef8b646a43d071b4c33d777446ba to your computer and use it in GitHub Desktop.
All the API requests for react-ssr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
const baseUri = 'http://localhost:3002'; | |
export const fetchAllMovies = () => | |
axios | |
.get(`${baseUri}/movies`) | |
.then(({ data }) => data) | |
.catch(e => { | |
console.log(e); | |
return null; | |
}); | |
export const fetchMovieById = id => | |
axios | |
.get(`${baseUri}/movie/${id}`) | |
.then(({ data }) => data) | |
.catch(e => { | |
console.warn(e); | |
return null; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment