Skip to content

Instantly share code, notes, and snippets.

@fraaalk
Created December 17, 2018 09:00
Show Gist options
  • Select an option

  • Save fraaalk/6b30bd7be3087d7e014ed4c5e69d7352 to your computer and use it in GitHub Desktop.

Select an option

Save fraaalk/6b30bd7be3087d7e014ed4c5e69d7352 to your computer and use it in GitHub Desktop.
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