Implement category tree via AJAX to avoid 500 errors on page load
This commit is contained in:
@@ -115,6 +115,16 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const initialPath = window.location.pathname === '/' ? '/items' : window.location.pathname;
|
||||
fetchContent(initialPath, false);
|
||||
|
||||
// Load category tree
|
||||
fetch('/api/tree')
|
||||
.then(response => response.text())
|
||||
.then(html => {
|
||||
document.querySelector('.sidebar').innerHTML = html;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error loading tree:', error);
|
||||
});
|
||||
|
||||
// Page-specific scripts (e.g., form submissions)
|
||||
function initPageSpecificScripts() {
|
||||
// Overview page: filter form
|
||||
|
||||
Reference in New Issue
Block a user