add logic when session expire redirect to login page

pull/37/head
usama.jameel 2025-06-30 09:58:45 +05:00
parent 59b572d691
commit b728efd305
3 changed files with 18 additions and 5 deletions

View File

@ -8,7 +8,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-8"> <div class="col-sm-8">
<table th:if="${#lists != null && #lists.size(poJobcardItems.keySet()) != 0 }" class="table table-bordered font-sm mb-4" data-dropdown-icon-summary > <table th:if="${#lists != null && #lists.size(poJobcardItems.keySet()) != 0 }" class="table table-bordered font-sm mb-4" data-order="[[ 0, &quot;desc&quot; ]]" data-dropdown-icon-summary >
<thead> <thead>
<tr> <tr>
<th>Sku</th> <th>Sku</th>

View File

@ -11,7 +11,7 @@
<h3>All PO's</h3> <h3>All PO's</h3>
<div class="table-responsive"> <!-- Bootstrap responsive table wrapper --> <div class="table-responsive"> <!-- Bootstrap responsive table wrapper -->
<table th:if="${ #lists != null && #lists.size(allPOs) != 0 }" <table th:if="${ #lists != null && #lists.size(allPOs) != 0 }"
class="table table-striped font-sm" style="min-width: 1500px;"> class="table table-striped font-sm" data-order="[[ 0, &quot;desc&quot; ]]" style="min-width: 1500px;">
<thead> <thead>
<tr> <tr>
<th>PO Number</th> <th>PO Number</th>
@ -299,8 +299,21 @@
$.ajax({ $.ajax({
url: `/ctp/po-status/po-items?poId=${poId}&size=${size}&color=${color}`, url: `/ctp/po-status/po-items?poId=${poId}&size=${size}&color=${color}`,
success: function( data ){ success: function( data ){
// show fetched page if (data.includes('page-login') ||
$row.child( data ).show(); data.includes('login__form') ||
data.includes('Sign in')) {
// Redirect to login page
window.location.href = '/ctp/login?logout';
} else {
$row.child(data).show();
}
},
error: function(xhr) {
if (xhr.status === 401) {
window.location.href = '/ctp/login?logout';
} else {
$row.child('<span class="text-danger">Error loading data</span>').show();
}
} }
}); });
} }

View File

@ -8,7 +8,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-8"> <div class="col-sm-8">
<table th:if="${#lists != null && #lists.size(storeItems.keySet()) != 0 }" class="table table-bordered font-sm mb-4" data-account-tables > <table th:if="${#lists != null && #lists.size(storeItems.keySet()) != 0 }" class="table table-bordered font-sm mb-4" data-order="[[ 0, &quot;desc&quot; ]]" data-account-tables >
<thead> <thead>
<tr> <tr>
<th th:each="heading : ${storeItems.keySet()}" th:text="${heading}"></th> <th th:each="heading : ${storeItems.keySet()}" th:text="${heading}"></th>