Skip to content

Instantly share code, notes, and snippets.

@sabljakovich
Created March 24, 2020 17:08
Show Gist options
  • Save sabljakovich/c037ea072d96c3c393bc499ae1313982 to your computer and use it in GitHub Desktop.
Save sabljakovich/c037ea072d96c3c393bc499ae1313982 to your computer and use it in GitHub Desktop.
const axios = require('axios').default;
axios.interceptors.request.use( x => {
// to avoid overwriting if another interceptor
// already defined the same object (meta)
x.meta = x.meta || {}
x.meta.requestStartedAt = new Date().getTime();
return x;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment