File tree Expand file tree Collapse file tree
src/components/MessageComponents/Messages Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,25 +32,27 @@ function formatDate(dateMilliseconds) {
3232 return strDate + " " + strTime
3333}
3434
35-
36-
3735const Messages = props => {
3836 // NOTE on React Hook: useState is used by React Hooks to create state variables and
3937 // setter function for component
4038 const { msgAlert } = props
4139 const [ messages , setMessages ] = useState ( [ ] )
4240
4341 function pollForNotifications ( ) {
42+
43+ if ( window . location . href . match ( / m e s s a g e s $ / ) === null ) {
44+ return
45+ }
4446 getMessageNotifications ( props ) // returns promise to get messages
4547 . then ( ( error , res ) => {
4648 getMessages ( props ) // returns promise to get messages
4749 . then ( res => {
48-
4950 setMessages ( res . data )
5051 setTimeout ( pollForNotifications , 3000 )
5152 } )
5253 } )
5354 . catch ( ( error , res ) => {
55+ console . log ( window . location )
5456 setTimeout ( pollForNotifications , 3000 )
5557 // displayUnexpectedFailure(msgAlert, error, 'fetching')
5658 } )
You can’t perform that action at this time.
0 commit comments