[object Object]

← back to Jutewallpaper

fix: product grid sort select now actually passes sort to /api/products

1216c56a0585f0488500d3d14da0b412b9f7e3db · 2026-05-18 20:52:59 -0700 · Steve Abrams

Files touched

Diff

commit 1216c56a0585f0488500d3d14da0b412b9f7e3db
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon May 18 20:52:59 2026 -0700

    fix: product grid sort select now actually passes 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 8e5145d..d8af086 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);

← 9abd8c0 hero-4grid: relocate json from data/ to public/ for Express  ·  back to Jutewallpaper  ·  fix: /api/facets total reports niche-filtered count not pre- f03c520 →