首页统计
This commit is contained in:
@@ -2,6 +2,7 @@ import './global.less';
|
||||
import React from 'react';
|
||||
import { ThemeProvider } from './theme';
|
||||
import { history } from 'umi';
|
||||
import { clearTenantCache, ensureTenantCacheTokenGuard } from '@/utils/tenantCache';
|
||||
|
||||
export function rootContainer(container: React.ReactNode, _args?: any) {
|
||||
return React.createElement(ThemeProvider, null, container);
|
||||
@@ -21,6 +22,7 @@ export const request: any = {
|
||||
try {
|
||||
sessionStorage.removeItem('access_token');
|
||||
sessionStorage.removeItem('current_user');
|
||||
clearTenantCache();
|
||||
} catch {}
|
||||
const pathname = typeof window !== 'undefined' ? window.location.pathname : '/';
|
||||
const search = typeof window !== 'undefined' ? window.location.search : '';
|
||||
@@ -39,6 +41,8 @@ export const request: any = {
|
||||
const token = sessionStorage.getItem('access_token');
|
||||
const headers: Record<string, string> = { ...(options?.headers as any) };
|
||||
if (token) headers['Authorization'] = `Bearer ${token}`;
|
||||
// 确保缓存与当前 Token 一致(Token 变化则清缓存)
|
||||
ensureTenantCacheTokenGuard();
|
||||
return { url, options: { ...options, headers } };
|
||||
},
|
||||
],
|
||||
@@ -65,6 +69,7 @@ export const request: any = {
|
||||
try {
|
||||
sessionStorage.removeItem('access_token');
|
||||
sessionStorage.removeItem('current_user');
|
||||
clearTenantCache();
|
||||
} catch {}
|
||||
const pathname = typeof window !== 'undefined' ? window.location.pathname : '/';
|
||||
const search = typeof window !== 'undefined' ? window.location.search : '';
|
||||
|
||||
Reference in New Issue
Block a user