2
redux-auth-wrapper을 사용하여 보호 된 경로의 인증을위한 라우팅 논리를 처리하고 있습니다. 그러나 리디렉션되지 않습니다. 상태에서redux-auth-wrapper 리디렉션이 작동하지 않습니다.
내 "사용자"개체는 모양입니다 :
// state.auth
{
isAuthenticated: true,
isLoading: false,
loadError: null
}
가 여기 내 routes/index.js
파일
const authenticated = UserAuthWrapper({
authSelector: state => state.auth,
predicate: authData => authData.isAuthenticated,
redirectAction: routerActions.replace,
// redirects to /login by default
})
export default (
<Route path="/" component={App}>
<IndexRoute component={authenticated(Secret)} />
<Route path="/login" component={Login} />
<Route path="/item_1" component={Item1} />
<Route path="/item_2" component={Item2}>
<Route path="/nested_item_2/:id" component={NestedItem2} />
</Route>
</Route>
)
내 IndexRoute
보호 구성 요소입니다, 그래서 localhost:3000
에 갈 때, 나를 /login
으로 리디렉션 할 것으로 예상되지만 아무 일도 발생하지 않습니다. null body가있는 Secret
구성 요소에 그대로 있습니다.
예! 그게 내가 한 짓이야. 게시해야하는 답변을 제공해 주셔서 감사합니다. – Carpetfizz