2025-07-09 14:01:45 +08:00
|
|
|
import { history } from 'umi';
|
|
|
|
|
|
|
|
export function onRouteChange({ location }: any) {
|
2025-07-14 08:43:22 +08:00
|
|
|
const token = sessionStorage.getItem('token');
|
2025-07-16 10:16:46 +08:00
|
|
|
const whiteList = ['/login', '/register/supplier', '/register/expert', '/403', '/404'];
|
2025-07-14 08:43:22 +08:00
|
|
|
if (!token && !whiteList.includes(location.pathname)) {
|
|
|
|
history.replace('/login');
|
|
|
|
}
|
2025-07-16 10:16:46 +08:00
|
|
|
|
2025-07-09 14:01:45 +08:00
|
|
|
}
|