You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
839 B

import{t as e}from"./axios-CiYFffbI.js";var t=`szkp_h5_verify_token`,n=`szkp_verify_portal_code`,r=`szkp_verify_portal_legacy_token`,i=`szkp_verify_auth_mode`,a=`https://szkp-map.langye.net/api`;function o(){let e=(window.location.pathname||``).includes(`/m/verify`)?`m/verify/login`:`h5/verify/login`,t=`/admin/`,n=t.endsWith(`/`)?t:`${t}/`;return`${window.location.origin}${n}${e}`}var s=e.create({baseURL:a,timeout:2e4});s.interceptors.request.use(e=>{let n=localStorage.getItem(t);return n&&(e.headers.Authorization=`Bearer ${n}`),e}),s.interceptors.response.use(e=>e,e=>{let n=e?.response?.status;if(n===401||n===403){localStorage.removeItem(t);let e=window.location.pathname||``;(e.includes(`/h5/verify`)||e.includes(`/m/verify`))&&window.location.replace(o())}return Promise.reject(e)});export{o as a,r as i,i as n,s as o,n as r,t};