MCPcopy
hub / github.com/kenberkeley/react-demo / userAuth

Function userAuth

src/utils/userAuth.js:8–15  ·  view source on GitHub ↗
(nextState, replace, next)

Source from the content-addressed store, hash-verified

6 * https://github.com/reactjs/react-router/blob/master/docs/API.md#onEnter
7 */
8export default function userAuth(nextState, replace, next) {
9 let { userData } = store.getState()
10 if (userData) return next()
11
12 alert('请先登录后再访问')
13 history.goBack()
14 // next(replace('/loginPage')) # 举例:跳转到登录页的写法
15}

Callers

nothing calls this directly

Calls 1

nextFunction · 0.85

Tested by

no test coverage detected