MSP-4164 add prevRoute to sessionStorage
This commit is contained in:
1 parent
369b5b0785
commit
41d94162d0
1 file changed
+10
@@ -1,6 +1,7 @@
|
||||
import { ConfigProvider } from 'antd'
|
||||
import ruRu from 'antd/locale/ru_RU'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
|
||||
import { darkTheme, lightTheme } from '@constants/theme.ts'
|
||||
|
||||
@@ -18,6 +19,15 @@ const App = () => {
|
||||
: true
|
||||
)
|
||||
|
||||
const location = useLocation()
|
||||
|
||||
useEffect(() => {
|
||||
const prevRoute = sessionStorage.getItem('prevRoute')
|
||||
if (location.pathname !== prevRoute) {
|
||||
sessionStorage.setItem('prevRoute', location.pathname)
|
||||
}
|
||||
}, [location])
|
||||
|
||||
useEffect(() => {
|
||||
setTheme(() => (changeTheme ? darkTheme : lightTheme))
|
||||
}, [changeTheme])
|
||||
|
||||
Reference in new issue
Block a user