remove old import
This commit is contained in:
@@ -804,7 +804,7 @@ function clearUploadFileNo() {
|
||||
|
||||
async function loadTemplates() {
|
||||
try {
|
||||
console.log('🔍 DEBUG: loadTemplates() called');
|
||||
// Loading templates...
|
||||
const search = document.getElementById('templateSearch').value;
|
||||
const category = document.getElementById('categoryFilter').value;
|
||||
|
||||
@@ -814,17 +814,17 @@ async function loadTemplates() {
|
||||
|
||||
// Ensure we have auth token for this API call
|
||||
const token = localStorage.getItem('auth_token');
|
||||
console.log('🔍 DEBUG: Token exists:', !!token, 'Length:', token?.length);
|
||||
// Token validation
|
||||
if (!token) {
|
||||
console.log('🔍 DEBUG: No token found, redirecting to login');
|
||||
// No token found, redirecting to login
|
||||
window.location.href = '/login';
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('🔍 DEBUG: Making API call to:', url);
|
||||
// Making API call
|
||||
|
||||
const response = await window.http.wrappedFetch(url);
|
||||
console.log('🔍 DEBUG: Response status:', response.status);
|
||||
// Processing response
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json().catch(() => ({ detail: 'Unknown error' }));
|
||||
@@ -832,10 +832,10 @@ async function loadTemplates() {
|
||||
}
|
||||
|
||||
const templates = await response.json();
|
||||
console.log('🔍 DEBUG: Templates loaded:', templates.length, 'items');
|
||||
// Templates loaded successfully
|
||||
displayTemplates(templates);
|
||||
} catch (error) {
|
||||
console.error('🔍 DEBUG: Error in loadTemplates:', error);
|
||||
console.error('Error in loadTemplates:', error);
|
||||
try { logClientError({ message: 'Error loading templates', action: 'loadTemplates', error }); } catch (_) {}
|
||||
showAlert('Error loading templates: ' + (error && error.message ? error.message : 'Unknown error'), 'danger');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user