From 511f919ffe2249f91ffa288b5d2f82e73f88052f Mon Sep 17 00:00:00 2001 From: Sergey Yarkov Date: Wed, 25 Aug 2021 17:47:43 +0300 Subject: [PATCH] fix: redirect to auth --- src/App.tsx | 6 ++++-- src/components/PrivateRoute/PrivateRoute.tsx | 2 +- src/stores/UIStore.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 6570971..445f553 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -21,9 +21,11 @@ import { UserRoleEnum } from 'enums'; import { useRootStore } from 'hooks/useRootStore'; const App = () => { - const { uiStore } = useRootStore(); + const { + uiStore: { history }, + } = useRootStore(); return ( - + diff --git a/src/components/PrivateRoute/PrivateRoute.tsx b/src/components/PrivateRoute/PrivateRoute.tsx index 201f336..b94d6a4 100644 --- a/src/components/PrivateRoute/PrivateRoute.tsx +++ b/src/components/PrivateRoute/PrivateRoute.tsx @@ -32,7 +32,7 @@ const PrivateRoute: React.FC = ({ component: Component, titl ) : ( - + ) } /> diff --git a/src/stores/UIStore.ts b/src/stores/UIStore.ts index 948513d..4d7a21b 100644 --- a/src/stores/UIStore.ts +++ b/src/stores/UIStore.ts @@ -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; });