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' ;
2
2
import Router from './routes/Router' ;
3
3
import Layout from './components/Layout/Layout' ;
4
4
import { connect } from 'react-redux' ;
@@ -10,7 +10,7 @@ import { AlertContext } from './contexts/AlertContext';
10
10
import Alert from '@material-ui/lab/Alert' ;
11
11
import { AxiosError } from './interfaces/axios/AxiosError'
12
12
import { ThemeContext } from './contexts/ThemeContext' ;
13
-
13
+ import { useLocation } from "react-router-dom" ;
14
14
15
15
16
16
type Error = {
@@ -34,11 +34,16 @@ function App(props: AppProps) {
34
34
const { alertType, openAlert, alertMessage, handleAlertClose } = useContext ( AlertContext ) ;
35
35
const { darkMode } = useContext ( ThemeContext ) ;
36
36
const palletType = darkMode ? "dark" : "light"
37
+ const location = useLocation ( ) . pathname
37
38
38
- React . useEffect ( ( ) => {
39
+ useEffect ( ( ) => {
39
40
props . setAuthenticatedIfRequired ( ) ;
40
41
} , [ props ] ) ;
41
42
43
+ useEffect ( ( ) => {
44
+ handleAlertClose ( )
45
+ } , [ location ] )
46
+
42
47
return (
43
48
< div className = "App" >
44
49
< ThemeProvider theme = { theme ( palletType ) } >
You can’t perform that action at this time.
0 commit comments