Socket
Socket
Sign inDemoInstall

@nuxtjs/axios

Package Overview
Dependencies
Maintainers
3
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxtjs/axios - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

<a name="3.1.0"></a>
# [3.1.0](https://github.com/nuxt/modules/compare/@nuxtjs/axios@3.0.1...@nuxtjs/axios@3.1.0) (2017-07-31)
### Features
* **axios:** requestInterceptor option (#100) ([fec7a9e](https://github.com/nuxt/modules/commit/fec7a9e))
<a name="3.0.1"></a>

@@ -8,0 +19,0 @@ ## [3.0.1](https://github.com/nuxt/modules/compare/@nuxtjs/axios@3.0.0...@nuxtjs/axios@3.0.1) (2017-07-25)

2

package.json
{
"name": "@nuxtjs/axios",
"version": "3.0.1",
"version": "3.1.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -138,2 +138,10 @@ import Axios from 'axios'

<% if (options.requestInterceptor) { %>
// Custom request interceptor
const reqInter = <%= serialize(options.requestInterceptor).replace('requestInterceptor(', 'function(') %>
axios.interceptors.request.use(
(config) => reqInter(config, ctx)
)
<% } %>
// Error handler

@@ -140,0 +148,0 @@ axios.interceptors.response.use(undefined, errorHandler.bind(ctx));

@@ -129,2 +129,17 @@ # Axios

### `requestInterceptor`
- Default: `null`
Function for manipulating axios requests. Useful for setting custom headers,
for example based on the store state. The second argument is the nuxt context.
```js
requestInterceptor: (config, { store }) => {
if (store.state.token) {
config.headers.common['Authorization'] = store.state.token
}
return config
}
```
## Helpers

@@ -131,0 +146,0 @@ ### `setHeader(name, value, scopes='common')`

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc