diff --git a/templates/web/common/menubar.html.twig b/templates/web/common/menubar.html.twig index d8021de270..cc528743eb 100644 --- a/templates/web/common/menubar.html.twig +++ b/templates/web/common/menubar.html.twig @@ -416,10 +416,13 @@ }); }); - /**manage session and redirect to login page**/ - var usr_id = '{{ app.getAuthenticator().user.getId }}'; - var module = '{{ module }}'; + // no need to launch pollNotifications if not connected on load page + {% if app.getAuthenticator().isAuthenticated() %} + /**manage session and redirect to login page**/ + var usr_id = '{{ app.getAuthenticator().user.getId }}'; + var module = '{{ module }}'; - // start pooling recursively - window.setTimeout( function() { commonModule.pollNotifications(usr_id, module === 'prod', true); }, 2000); + // start pooling recursively + window.setTimeout( function() { commonModule.pollNotifications(usr_id, module === 'prod', true); }, 2000); + {% endif %}