"use strict";var t=require("./vendor.js");class f{http(p,g={},l,r,i){var n=t.index.getStorageSync("requestPath");let a="";return i!=null?(n=i,a=t.index.getStorageSync("AppTokenmini_RTCourse")):(t.index.setStorageSync("requestPath",n),a=t.index.getStorageSync("AppToken")),new Promise((d,h)=>{let c=t.index.getStorageSync("CompanyUserToken");var s="application/x-www-form-urlencoded";r!=null&&(s=r),t.index.request({header:{"Content-Type":s,AppToken:a,CompanyUserToken:c},url:`${n}${p}`,data:g,method:l,success:e=>{if(e.data.code==401){let u=getCurrentPages(),o=u[u.length-1];if(console.log(o),o!=null&&o.route=="pages/auth/login"){d(e.data);return}t.index.navigateTo({url:"/pages/auth/login",success:()=>{},fail:()=>{}});return}e.data.token&&t.index.setStorageSync("AppToken",e.data.token),d(e.data)},fail:e=>{},complete:e=>{if(e.data.code==401)return!1}})})}}exports.Request=f;
