2 lines
935 B
JavaScript
2 lines
935 B
JavaScript
"use strict";var e=Object.defineProperty,r=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,s=(r,t,o)=>t in r?e(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;const n=require("../common/vendor.js");require("../store/index.js");const u=require("../utils/platform.js"),i=require("../store/user.js"),a={invoke(e){if(e.query){const r=n.qs.stringify(e.query);e.url.includes("?")?e.url+=`&${r}`:e.url+=`?${r}`}e.url.startsWith("http")||(e.url="http://116.204.119.171:48080/app-api"+e.url),e.timeout=1e4,e.header=((e,n)=>{for(var u in n||(n={}))t.call(n,u)&&s(e,u,n[u]);if(r)for(var u of r(n))o.call(n,u)&&s(e,u,n[u]);return e})({platform:u.platform},e.header);const a=i.useUserStore(),{token:l}=a.userInfo;l&&(e.header.Authorization=`Bearer ${l}`)}},l={install(){n.index.addInterceptor("request",a),n.index.addInterceptor("uploadFile",a)}};exports.requestInterceptor=l;
|