← back to Metallicwallpaper
fix sort select — pass state.sort through to /api/products query
83440f90bf138794b8b6d887db5fcb9d0a298ac7 · 2026-05-18 20:45:50 -0700 · Steve Abrams
Files touched
Diff
commit 83440f90bf138794b8b6d887db5fcb9d0a298ac7
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon May 18 20:45:50 2026 -0700
fix sort select — pass state.sort through to /api/products query
---
public/index.html | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/public/index.html b/public/index.html
index 66f8e3a..483280b 100644
--- a/public/index.html
+++ b/public/index.html
@@ -427,7 +427,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 => ({ '&':'&','<':'<','>':'>','"':'"',"'":''' }[c])); }
@@ -540,6 +540,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);
← 8180e32 hero-4grid: relocate json from data/ to public/ for Express
·
back to Metallicwallpaper
·
fix /api/facets total — use niche-filtered count not pre-nic a63b784 →