Created
December 17, 2018 09:00
-
-
Save fraaalk/6b30bd7be3087d7e014ed4c5e69d7352 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 https from 'https' | |
| export default function({ $axios }) { | |
| const agent = new https.Agent({ | |
| rejectUnauthorized: false | |
| }) | |
| $axios.onRequest(config => { | |
| if (process.env.dev) { | |
| config.httpsAgent = agent | |
| } | |
| }) | |
| $axios.onError(error => { | |
| const code = parseInt(error.response && error.response.status) | |
| if (code === 400) { | |
| redirect('/400') | |
| } | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment