diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index 3fe91386b251..b605d8896490 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -265,7 +265,7 @@ if (!window.loadedSearchData) { trackEvent('/activity', '/search'); - $.get('{{ URL::route('getSearchData') }}', function(data) { + var request = $.get('{{ URL::route('getSearchData') }}', function(data) { $('#search').typeahead({ hint: true, highlight: true, @@ -308,6 +308,13 @@ }).focus(); window.loadedSearchData = true; }); + + request.error(function(httpObj, textStatus) { + // if the session has expried show login page + if (httpObj.status == 401) { + location.reload(); + } + }); } }