How to use route hopping in request.js?

The

requirement is to check the login status through code (not http status code, but custom) returned from the backend in request.js . The following two ways have been tried. Although you can jump to the list page after login, the history.listen ()

in model cannot be triggered.

the first type
history.js

import createHistory from "history/createHashHistory"

const history = createHistory()

export default history

index.js

const app = dva({
    history
})

use
history.push ("/ login")

second type

import { routerRedux } from "dva/router"

const { dispatch } = app._store
dispatch(routerRedux.push("/login"))

both of these methods can jump, but both will create a separate history, so listen () will fail.

version

"dva": "^2.1.0",
"react": "^16.2.0",

ask for help
how to solve this problem? Or is there a better way to deal with the failure of user login and re-login?

Sep.07,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e888ed-5bd02.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e888ed-5bd02.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?