|
@@ -62,17 +62,17 @@ const Main = ({ _id }) => {
|
|
// actionClearDataUserType()
|
|
// actionClearDataUserType()
|
|
<Switch>
|
|
<Switch>
|
|
<Route path='/login'
|
|
<Route path='/login'
|
|
- component={CLoginForm} exact />
|
|
|
|
- {/* <Route path='/input'
|
|
|
|
- component={InputForm} /> */}
|
|
|
|
|
|
+ component={CLoginForm} />
|
|
|
|
+ <Route path='/input'
|
|
|
|
+ component={InputForm} />
|
|
<Route path='/register'
|
|
<Route path='/register'
|
|
component={CRegisterForm} />
|
|
component={CRegisterForm} />
|
|
- <CProtectedRoute
|
|
|
|
|
|
+ {/* <CProtectedRoute
|
|
roles={['anon']}
|
|
roles={['anon']}
|
|
fallback="/input"
|
|
fallback="/input"
|
|
path="/*"
|
|
path="/*"
|
|
component={InputForm}
|
|
component={InputForm}
|
|
- />
|
|
|
|
|
|
+ /> */}
|
|
{/* <Redirect from='/*' to='/input' /> */}
|
|
{/* <Redirect from='/*' to='/input' /> */}
|
|
</Switch >
|
|
</Switch >
|
|
// }
|
|
// }
|
|
@@ -85,12 +85,12 @@ const Main = ({ _id }) => {
|
|
<Route path="/edit/post/:_id" component={CPostEditor} />
|
|
<Route path="/edit/post/:_id" component={CPostEditor} />
|
|
<Route path="/post/:_id" component={CPost} />
|
|
<Route path="/post/:_id" component={CPost} />
|
|
<Route path="/feed" component={CPostForFeed} />
|
|
<Route path="/feed" component={CPostForFeed} />
|
|
- <CProtectedRoute
|
|
|
|
|
|
+ {/* <CProtectedRoute
|
|
roles={['user']}
|
|
roles={['user']}
|
|
fallback="/feed"
|
|
fallback="/feed"
|
|
path="/*"
|
|
path="/*"
|
|
component={CPostForFeed}
|
|
component={CPostForFeed}
|
|
- />
|
|
|
|
|
|
+ /> */}
|
|
|
|
|
|
</Switch>
|
|
</Switch>
|
|
)
|
|
)
|
|
@@ -134,9 +134,12 @@ function App() {
|
|
|
|
|
|
if (store.getState().auth?.token) {
|
|
if (store.getState().auth?.token) {
|
|
history.push('/feed')
|
|
history.push('/feed')
|
|
|
|
+ store.dispatch(actionRemoveDataUser())
|
|
|
|
+ // store.dispatch(actionClearUserData())
|
|
|
|
+ store.dispatch(actionClearDataUserType())
|
|
console.log('токен', store.getState().auth?.payload?.sub?.id)
|
|
console.log('токен', store.getState().auth?.payload?.sub?.id)
|
|
store.dispatch(actionFullProfilePage(store.getState().auth?.payload?.sub?.id))
|
|
store.dispatch(actionFullProfilePage(store.getState().auth?.payload?.sub?.id))
|
|
- store.dispatch(actionFullProfilePageUser(store.getState().auth?.payload?.sub?.id))
|
|
|
|
|
|
+ store.dispatch(actionFullProfilePageUser(store.getState().auth.payload.sub?.id))
|
|
localStorage.authToken = store.getState().auth?.token;
|
|
localStorage.authToken = store.getState().auth?.token;
|
|
}else {
|
|
}else {
|
|
history.push('/input')
|
|
history.push('/input')
|
|
@@ -145,13 +148,13 @@ function App() {
|
|
store.dispatch(actionClearDataUserType())
|
|
store.dispatch(actionClearDataUserType())
|
|
}
|
|
}
|
|
|
|
|
|
- store.getState().auth.payload?.sub?.id ? <Redirect to="/"/> : <Redirect to="/input"/>
|
|
|
|
|
|
+ // store.getState().auth.payload?.sub?.id ? <Redirect to="/"/> : <Redirect to="/input"/>
|
|
return (
|
|
return (
|
|
<Router history={history}>
|
|
<Router history={history}>
|
|
<Provider store={store}>
|
|
<Provider store={store}>
|
|
<div className="App">
|
|
<div className="App">
|
|
<Divider />
|
|
<Divider />
|
|
- <OldMain />
|
|
|
|
|
|
+ <CMain />
|
|
{/*
|
|
{/*
|
|
<CProtectedRoute
|
|
<CProtectedRoute
|
|
roles={['anon']}
|
|
roles={['anon']}
|