For search, if we get a 401, redirect to the login page

This commit is contained in:
Deon George 2022-08-03 16:32:38 +10:00
parent 8e9ca4c531
commit 61f38aefe7
2 changed files with 9 additions and 4 deletions

View File

@ -83,7 +83,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$("input[name=q]").typeahead({ $('input[name=q]').typeahead({
autoSelect: false, autoSelect: false,
scrollHeight: 10, scrollHeight: 10,
theme: 'bootstrap4', theme: 'bootstrap4',
@ -149,6 +149,11 @@
$('span[name=searching]').addClass("d-none"); $('span[name=searching]').addClass("d-none");
} }
} }
},
statusCode: {
401: function() {
window.parent.location.href = '{{ route('login') }}';
}
} }
}) })
}, 500); }, 500);

View File

@ -44,7 +44,7 @@
$.AdminLTESidebarTweak.Open = state; $.AdminLTESidebarTweak.Open = state;
if (addclass !== 'undefined') if (addclass !== 'undefined')
$("body") $('body')
.addClass(state ? 'sidebar-open' : 'sidebar-collapse'); .addClass(state ? 'sidebar-open' : 'sidebar-collapse');
$(this).delay($.AdminLTESidebarTweak.ResizeDelay).queue(function() { $(this).delay($.AdminLTESidebarTweak.ResizeDelay).queue(function() {
@ -56,7 +56,7 @@
$(function () { $(function () {
"use strict"; "use strict";
$("body").on("collapsed.lte.pushmenu", function(){ $('body').on('collapsed.lte.pushmenu', function(){
if($.AdminLTESidebarTweak.options.EnableRemember) { if($.AdminLTESidebarTweak.options.EnableRemember) {
document.cookie = "toggleState=closed;path=/"; document.cookie = "toggleState=closed;path=/";
@ -64,7 +64,7 @@
} }
}); });
$("body").on("shown.lte.pushmenu", function(){ $('body').on('shown.lte.pushmenu', function(){
if($.AdminLTESidebarTweak.options.EnableRemember){ if($.AdminLTESidebarTweak.options.EnableRemember){
document.cookie = "toggleState=opened;path=/"; document.cookie = "toggleState=opened;path=/";