@andbridge/glowpod 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/glowpod.esm.js +1 -1
- package/build/glowpod.js +1 -1
- package/build/glowpod.umd.js +1 -1
- package/package.json +1 -1
package/build/glowpod.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"axios";class t{constructor(t){this.getInstance=()=>this.instance,this.Get=e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Put=e=>this.instance({method:"PUT",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Delete=e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Post=e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.instance=e.create(t)}}const a=()=>{},s=()=>{},r=()=>{},o=200,n=299,d=({instance:e,authTokenStorageName:t="token",authFailedCaller:d=a,networkSuccessCode:
|
|
1
|
+
import e from"axios";class t{constructor(t){this.getInstance=()=>this.instance,this.Get=e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Put=e=>this.instance({method:"PUT",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Delete=e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Post=e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.instance=e.create(t)}}const a=()=>{},s=()=>{console.log("请配置全局错误处理")},r=()=>{},o=200,n=299,d=({instance:e,authTokenStorageName:t="token",authFailedCaller:d=a,networkSuccessCode:l=200,authFailedCode:h=401,networkFailedCaller:i=s,serverKillCaller:c=r,responseStruct:u={codeName:"code",messageName:"message",dataName:"data"}})=>{let m=null,p=!0;const g=e=>(m&&clearTimeout(m),m=setTimeout(()=>{if(p)return e.status<=o&&e.status>=n?c():e.data?.[u.codeName]==h?d():e.data?.[u.codeName]!=l?i(e.data):void 0},0),()=>p=!1);e.interceptors.request.use(async e=>{const a=localStorage.getItem(t);return a&&e.headers&&e.headers.set(t,a),e},e=>(console.log("请求错误拦截器:",e),g(e),Promise.reject(e))),e.interceptors.response.use(e=>{if("blob"===e.config.responseType)return e;if(e.data?.[u.codeName]===l)return e.data?.[u.dataName];{const t=g(e);throw{...e,hiddenDefaultErrorHandler:t}}},e=>{const t=g(e);throw{...e,hiddenDefaultErrorHandler:t}})};export{t as GlowPod,d as setupInterceptors};
|
package/build/glowpod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("axios");const t=()=>{},
|
|
1
|
+
"use strict";var e=require("axios");const t=()=>{},a=()=>{console.log("请配置全局错误处理")},s=()=>{},r=200,o=299;exports.GlowPod=class{constructor(t){this.getInstance=()=>this.instance,this.Get=e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Put=e=>this.instance({method:"PUT",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Delete=e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Post=e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.instance=e.create(t)}},exports.setupInterceptors=({instance:e,authTokenStorageName:n="token",authFailedCaller:d=t,networkSuccessCode:i=200,authFailedCode:l=401,networkFailedCaller:c=a,serverKillCaller:h=s,responseStruct:u={codeName:"code",messageName:"message",dataName:"data"}})=>{let m=null,p=!0;const g=e=>(m&&clearTimeout(m),m=setTimeout(()=>{if(p)return e.status<=r&&e.status>=o?h():e.data?.[u.codeName]==l?d():e.data?.[u.codeName]!=i?c(e.data):void 0},0),()=>p=!1);e.interceptors.request.use(async e=>{const t=localStorage.getItem(n);return t&&e.headers&&e.headers.set(n,t),e},e=>(console.log("请求错误拦截器:",e),g(e),Promise.reject(e))),e.interceptors.response.use(e=>{if("blob"===e.config.responseType)return e;if(e.data?.[u.codeName]===i)return e.data?.[u.dataName];{const t=g(e);throw{...e,hiddenDefaultErrorHandler:t}}},e=>{const t=g(e);throw{...e,hiddenDefaultErrorHandler:t}})};
|
package/build/glowpod.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).GlowPod={},e.axios)}(this,function(e,t){"use strict";const s=()=>{},a=()=>{},r=()=>{},o=200,n=299;e.GlowPod=class{constructor(e){this.getInstance=()=>this.instance,this.Get=e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Put=e=>this.instance({method:"PUT",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Delete=e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Post=e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.instance=t.create(e)}},e.setupInterceptors=({instance:e,authTokenStorageName:t="token",authFailedCaller:d=s,networkSuccessCode:i=200,authFailedCode:l=401,networkFailedCaller:c=a,serverKillCaller:h=r,responseStruct:u={codeName:"code",messageName:"message",dataName:"data"}})=>{let m=null,p=!0;const f=e=>(m&&clearTimeout(m),m=setTimeout(()=>{if(p)return e.status<=o&&e.status>=n?h():e.data?.[u.codeName]==l?d():e.data?.[u.codeName]!=i?c():void 0},0),()=>p=!1);e.interceptors.request.use(async e=>{const s=localStorage.getItem(t);return s&&e.headers&&e.headers.set(t,s),e},e=>(console.log("请求错误拦截器:",e),f(e),Promise.reject(e))),e.interceptors.response.use(e=>{if("blob"===e.config.responseType)return e;if(e.data?.[u.codeName]===i)return e.data?.[u.dataName];{const t=f(e);throw{...e,hiddenDefaultErrorHandler:t}}},e=>{const t=f(e);throw{...e,hiddenDefaultErrorHandler:t}})}});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).GlowPod={},e.axios)}(this,function(e,t){"use strict";const s=()=>{},a=()=>{console.log("请配置全局错误处理")},r=()=>{},o=200,n=299;e.GlowPod=class{constructor(e){this.getInstance=()=>this.instance,this.Get=e=>this.instance({method:"GET",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Put=e=>this.instance({method:"PUT",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Delete=e=>this.instance({method:"DELETE",url:e.url,params:e.params,headers:{...e.headers},...e.others}),this.Post=e=>this.instance({method:"POST",url:e.url,data:e.params,headers:{...e.headers},...e.others}),this.instance=t.create(e)}},e.setupInterceptors=({instance:e,authTokenStorageName:t="token",authFailedCaller:d=s,networkSuccessCode:i=200,authFailedCode:l=401,networkFailedCaller:c=a,serverKillCaller:h=r,responseStruct:u={codeName:"code",messageName:"message",dataName:"data"}})=>{let m=null,p=!0;const f=e=>(m&&clearTimeout(m),m=setTimeout(()=>{if(p)return e.status<=o&&e.status>=n?h():e.data?.[u.codeName]==l?d():e.data?.[u.codeName]!=i?c(e.data):void 0},0),()=>p=!1);e.interceptors.request.use(async e=>{const s=localStorage.getItem(t);return s&&e.headers&&e.headers.set(t,s),e},e=>(console.log("请求错误拦截器:",e),f(e),Promise.reject(e))),e.interceptors.response.use(e=>{if("blob"===e.config.responseType)return e;if(e.data?.[u.codeName]===i)return e.data?.[u.dataName];{const t=f(e);throw{...e,hiddenDefaultErrorHandler:t}}},e=>{const t=f(e);throw{...e,hiddenDefaultErrorHandler:t}})}});
|