diff --git a/clientapp/src/App.tsx b/clientapp/src/App.tsx index f4b9561..bc91557 100644 --- a/clientapp/src/App.tsx +++ b/clientapp/src/App.tsx @@ -1,5 +1,5 @@ import React, { FC, useEffect } from 'react' -import { Route, Routes } from 'react-router' +import { Route, Routes, useLocation } from 'react-router' //Redux import { useSelector, useDispatch } from 'react-redux' @@ -36,6 +36,7 @@ const NestedRoutes = (routes: IRoute[], tag: string | undefined = undefined) => const App: FC = () => { + const { pathname } = useLocation() const dispatch = useDispatch() const { routes, adminRoutes, serviceRoutes } = useSelector((state: IReduxState) => state.settings) @@ -43,6 +44,13 @@ const App: FC = () => { dispatch(settingsActionCreators.requestSettings()) }, []) + useEffect(() => { + window.scrollTo({ + top: 0, + behavior: 'smooth', + }) + }, [pathname]) + return <> { NestedRoutes(routes, 'PublicLayout') } diff --git a/clientapp/src/layouts/public/Footer/index.tsx b/clientapp/src/layouts/public/Footer/index.tsx index b39422e..2f66c81 100644 --- a/clientapp/src/layouts/public/Footer/index.tsx +++ b/clientapp/src/layouts/public/Footer/index.tsx @@ -6,10 +6,9 @@ import { IReduxState } from '../../../interfaces' const Footer = () => { let { siteName } = useSelector((state: IReduxState) => state.settings) - return