UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

29 lines (26 loc) 1.44 kB
import _classCallCheck from '@babel/runtime/helpers/classCallCheck'; import _createClass from '@babel/runtime/helpers/createClass'; /** * Cocos 端响应登录态拦截器 * * 后台在响应 header `logininfo` 中下发登录态 JSON 字符串,本拦截器解析并写入 storage。 * 后续请求的 CocosLoginInfoParamInterceptor 会把它塞进 body.login_info。 * * 参考 pmd-npm/packages/business/src/network/interceptor/response/cocos/cocosLoginInfoInterceptor.ts */ var CocosLoginInfoResponseInterceptor = /*#__PURE__*/function () { function CocosLoginInfoResponseInterceptor(options) { _classCallCheck(this, CocosLoginInfoResponseInterceptor); this.options = options; } return _createClass(CocosLoginInfoResponseInterceptor, [{ key: "interceptor", value: function interceptor(param) { var _a, _b, _c, _d, _e, _f; // 大小写不敏感取 logininfo ((_b = (_a = param.response) === null || _a === void 0 ? void 0 : _a.getHeader) === null || _b === void 0 ? void 0 : _b.call(_a, 'logininfo')) || ((_d = (_c = param.response) === null || _c === void 0 ? void 0 : _c.getHeader) === null || _d === void 0 ? void 0 : _d.call(_c, 'Logininfo')) || ((_f = (_e = param.response) === null || _e === void 0 ? void 0 : _e.getHeader) === null || _f === void 0 ? void 0 : _f.call(_e, 'LoginInfo')); return [false, param]; } }]); }(); export { CocosLoginInfoResponseInterceptor };