Skip to content

Instantly share code, notes, and snippets.

@Calvin-Huang
Created September 16, 2022 04:35
Show Gist options
  • Save Calvin-Huang/4f2fa7b2552a7b0777f4f96d8c0cfd25 to your computer and use it in GitHub Desktop.
Save Calvin-Huang/4f2fa7b2552a7b0777f4f96d8c0cfd25 to your computer and use it in GitHub Desktop.
simple example to transform response from underscore to camelCase in axios interceptor
// Add a response interceptor
axios.interceptors.response.use(function (response) {
// Any status code that lie within the range of 2xx cause this function to trigger
// Do something with response data
return {
...response,
data: humps.camelizeKeys(response.data),
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment