File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1- import React , { Dispatch , useContext , useState } from 'react' ;
1+ import React , { Dispatch , useContext , useEffect } from 'react' ;
22import Router from './routes/Router' ;
33import Layout from './components/Layout/Layout' ;
44import { connect } from 'react-redux' ;
@@ -10,7 +10,7 @@ import { AlertContext } from './contexts/AlertContext';
1010import Alert from '@material-ui/lab/Alert' ;
1111import { AxiosError } from './interfaces/axios/AxiosError'
1212import { ThemeContext } from './contexts/ThemeContext' ;
13-
13+ import { useLocation } from "react-router-dom" ;
1414
1515
1616type Error = {
@@ -34,11 +34,16 @@ function App(props: AppProps) {
3434 const { alertType, openAlert, alertMessage, handleAlertClose } = useContext ( AlertContext ) ;
3535 const { darkMode } = useContext ( ThemeContext ) ;
3636 const palletType = darkMode ? "dark" : "light"
37+ const location = useLocation ( ) . pathname
3738
38- React . useEffect ( ( ) => {
39+ useEffect ( ( ) => {
3940 props . setAuthenticatedIfRequired ( ) ;
4041 } , [ props ] ) ;
4142
43+ useEffect ( ( ) => {
44+ handleAlertClose ( )
45+ } , [ location ] )
46+
4247 return (
4348 < div className = "App" >
4449 < ThemeProvider theme = { theme ( palletType ) } >
You can’t perform that action at this time.
0 commit comments