[object Object]

← back to Architecturalwallcoverings

fix non-functional sort select — pass state.sort to /api/products

9609ab0180fa1fefd7ac870f9aa419cb7f87043a · 2026-05-18 20:37:10 -0700 · SteveStudio2

Files touched

Diff

commit 9609ab0180fa1fefd7ac870f9aa419cb7f87043a
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date:   Mon May 18 20:37:10 2026 -0700

    fix non-functional sort select — pass state.sort to /api/products
---
 public/index.html | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/public/index.html b/public/index.html
index 6228b53..d24d3c4 100644
--- a/public/index.html
+++ b/public/index.html
@@ -430,7 +430,7 @@ textarea:focus-visible,
 </script>
 
 <script>
-const state = { q:'', facet:'all', page:1, pages:1, total:0, loading:false, exhausted:false };
+const state = { q:'', facet:'all', sort:'newest', page:1, pages:1, total:0, loading:false, exhausted:false };
 const LABELS = {"all":"All"};
 
 function escAttr(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;' }[c])); }
@@ -543,6 +543,7 @@ async function loadGridPage() {
   const params = new URLSearchParams({ page:state.page, limit:24 });
   if (state.q) params.set('q', state.q);
   if (state.facet !== 'all') params.set('aesthetic', state.facet);
+  if (state.sort && state.sort !== 'newest') params.set('sort', state.sort);
   let data;
   try {
     const r = await fetch('/api/products?' + params);

← 4f1b26a hero-4grid: relocate json from data/ to public/ for Express  ·  back to Architecturalwallcoverings  ·  untrack 30 stale .bak/.pre-* snapshots (25 served from publi 753811e →