Created
June 7, 2019 01:55
-
-
Save gtalarico/2e7bb6f4227a26d65611d49b9782300e to your computer and use it in GitHub Desktop.
Netlify Lambda Service
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
// lambdaService.js | |
import axios from 'axios' | |
const $axios = axios.create({ | |
baseURL: '/.netlify/functions', | |
timeout: 10000 // 10 seconds | |
}) | |
// Response Interceptor to handle and log errors | |
$axios.interceptors.response.use( | |
function(response) { | |
return response | |
}, | |
function(error) { | |
return Promise.reject(error) | |
} | |
) | |
export default { | |
fetchRecords() { | |
return $axios.get('airtable').then(response => { | |
return response.data | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment