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
1.1 KiB

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=localStorage.getItem(n),t=localStorage.getItem(r),i=(window.location.pathname||``).includes(`/m/verify`)?`m/verify/login`:`h5/verify/login`,a=`/admin/`,o=a.endsWith(`/`)?a:`${a}/`,s=new URL(`${window.location.origin}${o}${i}`);return e?s.searchParams.set(`v`,e):t&&s.searchParams.set(`portal`,t),s.toString()}function s(e){let t=`/admin/`,n=t.endsWith(`/`)?t:`${t}/`,r=new URL(`${window.location.origin}${n}h5/verify/login`);return r.searchParams.set(`v`,String(e).toLowerCase().trim()),r.toString()}var c=e.create({baseURL:a,timeout:2e4});c.interceptors.request.use(e=>{let n=localStorage.getItem(t);return n&&(e.headers.Authorization=`Bearer ${n}`),e}),c.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{s as a,r as i,i as n,c as o,n as r,t};