axios-patch
Advanced tools
Comparing version 0.2.1 to 0.2.2
13
index.js
@@ -10,7 +10,5 @@ 'use strict'; | ||
globalAxios.interceptors.response.use(res => { | ||
delete res.config[contextKey]; | ||
return res; | ||
}, err => { | ||
let stackFromOrigin = err.config[contextKey] && err.config[contextKey].stack; | ||
globalAxios.interceptors.response.use(undefined, err => { | ||
const context = err.config && err.config[contextKey]; | ||
let stackFromOrigin = context && context.stack; | ||
if (stackFromOrigin) { | ||
@@ -25,3 +23,2 @@ if (err.stack) { | ||
} | ||
delete err.config[contextKey]; | ||
return Promise.reject(err); | ||
@@ -72,3 +69,3 @@ }); | ||
Object.entries(methodMap).forEach(function (kv) { | ||
var method = kv[0], reqConfIdx = kv[1]; | ||
const method = kv[0], reqConfIdx = kv[1]; | ||
if (typeof axios[method] !== 'function') { | ||
@@ -85,3 +82,3 @@ return; | ||
if (typeof args[reqConfIdx] === 'object') { | ||
var reqCtx = args[reqConfIdx][contextKey] = args[reqConfIdx][contextKey] || {}; | ||
const reqCtx = args[reqConfIdx][contextKey] = args[reqConfIdx][contextKey] || {}; | ||
reqCtx.stack = new Error().stack; | ||
@@ -88,0 +85,0 @@ } |
{ | ||
"name": "axios-patch", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Better usage for axios", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
3133
80