Created
July 31, 2019 16:38
-
-
Save Ackuq/5f338e3cfefadb9d3715ea7268f24ac5 to your computer and use it in GitHub Desktop.
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 Config from 'react-native-config'; | |
export const fetchApiData = async route => { | |
try { | |
const response = await fetch(Config.API_URL + route); | |
const json = await response.json(); | |
return json; | |
} catch (error) { | |
console.error(error); | |
return null; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment