0
응용 프로그램을 개발 중이며 redux-auth-wrapper의 리디렉션 문제가 있습니다. 문서를 따라 갔지만이 문제점이 있습니다. 항상 예를 들어 로그인 후 집에 할 수 있어요 :리디렉션 백엔드로 redux-auth-wrapper 문제 - 항상 집으로 리디렉션합니다.
나는 액세스 :
http://localhost:3000/admin
내가로 리디렉션 해요 :
http://localhost:3000/login?redirect=%2Fadmin it's ritght!
하지만 로그인 후에 내가
로 리디렉션 해요http://localhost:3000/
로그인 한 후 어떻게해야합니까?
내 버전 :
"react-redux": "4.4.5",
"react-router": "3.2.0",
"react-router-redux": "4.0.6",
"redux": "3.6.0",
"redux-auth-wrapper": "2.0.2",
내 auth.js :
import locationHelperBuilder from 'redux-auth-wrapper/history3/locationHelper'
import { connectedRouterRedirect } from 'redux-auth-wrapper/history3/redirect'
import { routerActions } from 'react-router-redux'
import { Loading } from './components'
const locationHelper = locationHelperBuilder({})
export const userIsAuthenticated = connectedRouterRedirect({
redirectPath: '/login',
authenticatedSelector: state => state.auth.isAuthenticated,
authenticatingSelector: state => state.auth.isLoading,
AuthenticatingComponent: Loading,
redirectAction: routerActions.replace,
wrapperDisplayName: 'UserIsAuthenticated'
})
export const userIsAdmin = connectedRouterRedirect({
redirectPath: '/',
allowRedirectBack: false,
authenticatedSelector: state => state.auth.data !== null && state.auth.data.isAdmin,
redirectAction: routerActions.replace,
wrapperDisplayName: 'UserIsAdmin'
})
export const userIsNotAuthenticated = connectedRouterRedirect({
redirectPath: (state, ownProps) => locationHelper.getRedirectQueryParam(ownProps) || '/foo',
allowRedirectBack: false,
// Want to redirect the user when they are done loading and authenticated
authenticatedSelector: state => state.auth.data === null && state.auth.isLoading === false,
redirectAction: routerActions.replace,
wrapperDisplayName: 'UserIsNotAuthenticated'
})
내 routes.js :
import React from 'react';
import { Route , IndexRoute } from 'react-router';
import App from './components/App';
import LoginPage from './containers/LoginPage';
import LogoutPage from './containers/LogoutPage';
import AdminPage from './containers/AdminPage';
import SelectSolution from './containers/SelectSolution';
import AboutPage from './components/AboutPage.js';
import NotFoundPage from './components/NotFoundPage.js';
import { userIsAuthenticated
// , userIsAdmin
// , userIsNotAuthenticated
} from './auth'
export default (
<Route path="/" component={App}>
<IndexRoute component={SelectSolution}/>
<Route path="login" component={LoginPage}/>
<Route path="logout" component={LogoutPage}/>
<Route path="admin" component={userIsAuthenticated(AdminPage)}/>
<Route path="about" component={AboutPage}/>
<Route path="*" component={NotFoundPage}/>
</Route>
);
누군가가 나를 도울 수 있습니까?
죄송합니다. 내 로그인 구성 요소 : – bugalaws