完成router配置
This commit is contained in:
		| @@ -7,6 +7,7 @@ import { ReviewContainer } from './review/review'; | ||||
| import History from './helper/history'; | ||||
|  | ||||
| function App() { | ||||
|   // TODO check login | ||||
|   return ( | ||||
|     <SingleRouter history={History}> | ||||
|       <Route path="/" component={AppContainer} /> | ||||
|   | ||||
| @@ -59,5 +59,5 @@ export function Redirect(props) { | ||||
| } | ||||
|  | ||||
| export function Link(props) { | ||||
|   return (<a href={`/#${props.to}`} {...props}>{props.children}</a>); | ||||
|   return (<a href={`#${props.to}`} {...props}>{props.children}</a>); | ||||
| } | ||||
| @@ -47,7 +47,7 @@ async function send(xhr, retryFunc) { | ||||
|     if (err.message === 'Network Error') | ||||
|       return await failed('您的设备似乎断网了,请检查网络后重试或刷新', flushWaitList) || failData; | ||||
|     else if (err?.response?.status === 401) | ||||
|       window.history.replaceState({}, '', '#/login'); | ||||
|       History.force('/login'); | ||||
|     else if (err?.response?.status === 504) | ||||
|       return await failed('请求超时,请耐心等待几秒后重试或刷新', flushWaitList) || failData; | ||||
|     else | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import { Component } from 'react'; | ||||
| import { Link } from 'react-router-dom'; | ||||
| import { Link } from '../components/SingleRouter/SingleRouter'; | ||||
| import './index.css'; | ||||
|  | ||||
| export class AppContainer extends Component { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user