@nuxtjs/axios
Advanced tools
Comparing version 4.4.0 to 4.5.0
@@ -5,2 +5,17 @@ # Change Log | ||
<a name="4.5.0"></a> | ||
# [4.5.0](https://github.com/nuxt-community/axios-module/compare/v4.4.0...v4.5.0) (2017-11-16) | ||
### Bug Fixes | ||
* link to the proxy page ([5449939](https://github.com/nuxt-community/axios-module/commit/5449939)) | ||
### Features | ||
* disable sefault error handler ([#44](https://github.com/nuxt-community/axios-module/issues/44)) ([f1e95ff](https://github.com/nuxt-community/axios-module/commit/f1e95ff)) | ||
<a name="4.4.0"></a> | ||
@@ -7,0 +22,0 @@ # [4.4.0](https://github.com/nuxt-community/axios-module/compare/v4.3.1...v4.4.0) (2017-09-30) |
@@ -22,2 +22,3 @@ const chalk = require('chalk') | ||
debug: false, | ||
disableDefaultErrorHandler: false, | ||
redirectError: {} | ||
@@ -24,0 +25,0 @@ } |
@@ -175,9 +175,9 @@ import Axios from 'axios' | ||
<% } %> | ||
// Error handler | ||
axios.interceptors.response.use(undefined, err => errorHandler(err, ctx)); | ||
<% if (options.errorHandler) { %> | ||
// Custom error handler | ||
axios.interceptors.response.use(undefined, err => customErrorHandler(err, ctx)) | ||
<% } else if (options.disableDefaultErrorHandler === false) { %> | ||
axios.interceptors.response.use(undefined, err => errorHandler(err, ctx)); | ||
<% } %> | ||
@@ -184,0 +184,0 @@ |
{ | ||
"name": "@nuxtjs/axios", | ||
"version": "4.4.0", | ||
"version": "4.5.0", | ||
"description": "Secure and easy axios integration with Nuxt.js", | ||
@@ -36,4 +36,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"axios": "^0.16.2", | ||
"chalk": "^2.1.0", | ||
"axios": "^0.17.1", | ||
"chalk": "^2.3.0", | ||
"debug": "^3.1.0", | ||
@@ -44,15 +44,15 @@ "whatwg-url": "^6.3.0" | ||
"nuxt": "^1.0.0-rc11", | ||
"codecov": "^2.3.0", | ||
"eslint": "^4.7.2", | ||
"codecov": "^3.0.0", | ||
"eslint": "^4.11.0", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-jest": "^21.2.0", | ||
"eslint-plugin-node": "^5.2.0", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-jest": "^21.3.2", | ||
"eslint-plugin-node": "^5.2.1", | ||
"eslint-plugin-promise": "^3.6.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"eslint-plugin-vue": "^2.1.0", | ||
"jest": "^21.2.1", | ||
"jsdom": "^11.2.0", | ||
"jsdom": "^11.3.0", | ||
"standard-version": "^4.2.0" | ||
} | ||
} |
@@ -38,3 +38,3 @@ <p align="center"> | ||
- [Usage](#usage) | ||
- [Component](#component-asyncdata) | ||
- [Component](#component) | ||
- [Store](#store-nuxtserverinit) | ||
@@ -47,3 +47,3 @@ - [Store Actions](#store-actions) | ||
- [proxyHeaders](#proxyheaders) | ||
- [proxyHeadersIgnore](#proxyHeadersIgnore) | ||
- [proxyHeadersIgnore](#proxyheadersignore) | ||
- [redirectError](#redirecterror) | ||
@@ -53,2 +53,3 @@ - [requestInterceptor](#requestinterceptor) | ||
- [init](#init) | ||
- [disableDefaultErrorHandler](#disabledefaulterrorhandler) | ||
- [errorHandler](#errorhandler) | ||
@@ -66,3 +67,3 @@ - [Helpers](#helpers) | ||
- Throws *nuxt-friendly* errors and optionally redirect on specific error codes | ||
- Automatically enables `withCredentials` when requesting to base URL](#credentials) | ||
- Automatically enables `withCredentials` when requesting to base URL | ||
- Proxy request headers in SSR (Useful for auth) | ||
@@ -76,3 +77,3 @@ - Fetch Style requests | ||
>_ npm install @nuxtjs/axios | ||
``` | ||
``` | ||
@@ -100,4 +101,6 @@ Install with yarn: | ||
### Component `asyncData` | ||
### Component | ||
**`asyncData`** | ||
```js | ||
@@ -110,2 +113,13 @@ async asyncData({ app }) { | ||
**`methods`/`created`/`mounted`/etc** | ||
```js | ||
methods: { | ||
async fetchSomething() { | ||
const ip = await this.$axios.$get('http://icanhazip.com') | ||
this.ip = ip | ||
} | ||
} | ||
``` | ||
### Store `nuxtServerInit` | ||
@@ -216,3 +230,3 @@ ```js | ||
Function for manipulating axios responses. | ||
Function for manipulating axios responses. | ||
@@ -232,8 +246,16 @@ ### `init` | ||
### `disableDefaultErrorHandler` | ||
- Default: `false` | ||
If you want to disable the default error handler for some reason, you can do it so | ||
by setting the option `disableDefaultErrorHandler` to true. | ||
### `errorHandler` | ||
- Default: (Return promise rejection with error) | ||
Function for custom global error handler. | ||
Function for custom global error handler. | ||
This example uses nuxt default error page. | ||
If you define a custom error handler, the default error handler provided by this package will be overridden. | ||
```js | ||
@@ -325,3 +347,3 @@ axios: { | ||
proxy: [ | ||
['/api', { target: 'http://www.mocky.io', pathRewrite: { '^/api': '/v2' } }] | ||
['/api', { target: process.env.PROXY_API_URL || 'http://www.mocky.io', pathRewrite: { '^/api': '/v2' } }] | ||
] | ||
@@ -357,3 +379,3 @@ } | ||
- We used `pathRewrite` to remove `/api` from starting of requests and change it to `/v2` | ||
- For more information and advanced usage please refer to [proxy](../proxy) docs. | ||
- For more information and advanced usage please refer to [proxy](https://github.com/nuxt-community/modules/blob/master/packages/proxy) docs. | ||
@@ -360,0 +382,0 @@ ## License |
29279
217
376
+ Addedaxios@0.17.1(transitive)
- Removedaxios@0.16.2(transitive)
Updatedaxios@^0.17.1
Updatedchalk@^2.3.0