"use strict";const e=require("../vendor.js"),r=require("../store/useWeAppAuthStore.js"),t=new e.Request;t.setConfig(e=>(e.baseURL="https://weapp-api.linyikj.com.cn/api/",e.header={...e.header},e)),t.interceptors.request.use(r=>(r.header={...r.header,Authorization:"Bearer "+e.index.getStorageSync("NCHL_PROD_ACCESS_TOKEN_CUSTOMER")},r),e=>Promise.reject(e)),t.interceptors.response.use(t=>{const o=t.data;if(e.index.hideLoading(),!0!==o.success){if(10001===o.errorCode){r.useWeAppAuthStore().loading=!1,e.index.showToast({title:o.errorMessage,icon:"none"})}else e.index.showToast({title:o.errorMessage,icon:"none"});return Promise.reject(t.data)}return t.data},e=>{console.log("error",e);return r.useWeAppAuthStore().loading=!1,Promise.reject(e)}),exports.request=function(e,r){return t.post(e,r.data)};
