mirror of
https://github.com/sergeyyarkov/educt-client.git
synced 2026-10-11 10:19:22 +03:00
fix: redirect to auth
This commit is contained in:
parent
f48c1d2a2c
commit
511f919ffe
@ -21,9 +21,11 @@ import { UserRoleEnum } from 'enums';
|
||||
import { useRootStore } from 'hooks/useRootStore';
|
||||
|
||||
const App = () => {
|
||||
const { uiStore } = useRootStore();
|
||||
const {
|
||||
uiStore: { history },
|
||||
} = useRootStore();
|
||||
return (
|
||||
<Router history={uiStore.history}>
|
||||
<Router history={history}>
|
||||
<Switch>
|
||||
<PrivateRoute exact path='/' component={MainPage} title='Home' />
|
||||
<PrivateRoute path='/courses' component={CoursesPage} title='Courses' />
|
||||
|
||||
@ -32,7 +32,7 @@ const PrivateRoute: React.FC<IPrivateRouteProps> = ({ component: Component, titl
|
||||
</Layout>
|
||||
</ErrorBoundary>
|
||||
) : (
|
||||
<Redirect to={{ pathname: '/auth', state: { from: props.location } }} />
|
||||
<Redirect to='/auth' />
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
@ -15,7 +15,7 @@ export default class UIStore {
|
||||
makeAutoObservable(this);
|
||||
|
||||
this.history.listen(({ pathname }) => {
|
||||
console.log('path chaged');
|
||||
console.log(`[history]: pathname changed to ${pathname}`);
|
||||
|
||||
this.location = pathname;
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user