Fix search when session has expired

This commit is contained in:
Hillel Coren 2016-07-04 10:59:30 +03:00
parent 65d0e350d0
commit a56134050d

View File

@ -265,7 +265,7 @@
if (!window.loadedSearchData) { if (!window.loadedSearchData) {
trackEvent('/activity', '/search'); trackEvent('/activity', '/search');
$.get('{{ URL::route('getSearchData') }}', function(data) { var request = $.get('{{ URL::route('getSearchData') }}', function(data) {
$('#search').typeahead({ $('#search').typeahead({
hint: true, hint: true,
highlight: true, highlight: true,
@ -308,6 +308,13 @@
}).focus(); }).focus();
window.loadedSearchData = true; window.loadedSearchData = true;
}); });
request.error(function(httpObj, textStatus) {
// if the session has expried show login page
if (httpObj.status == 401) {
location.reload();
}
});
} }
} }