import { QueryClient } from 'https://kevisual.xiongxiao.me/system/lib'; const env = window.env || {}; const isDev = location.hostname === 'localhost'; const productionUrl = env?.productionUrl || 'https://envision.xiongxiao.me/api/router'; const url = isDev ? 'http://localhost:4002/api/router' : productionUrl; export const query = new QueryClient({ url, }); query.after((res) => { const pathname = window.location.pathname; if (res.code === 401 && !pathname.includes('login')) { console.log('401'); if (env?.needLogin) { window.location.href = env?.needLoginUrl || '/user/login'; } } return res; });