4wash
  • Home
  • Shop
  • History

Shop

All products are made to order. Ships within 5 working days.

© 2024 4wash. All rights reserved. | Impressum

Cart
Total €0.00
(async () => { try { const res = await fetch('/api/products'); if (!res.ok) throw new Error(`HTTP ${res.status}`); const products = await res.json(); const grid = document.getElementById('product-grid'); grid.innerHTML = products.map(p => { const swatchStyle = p.color ? `background:${p.color};` : ''; const swatchClass = !p.color ? 'product-swatch-multi' : ''; const swatchIcon = p.color === null ? '⬡' : ''; return `
${swatchIcon}
${p.name}
${p.description}
€${p.price.toFixed(2)}
`; }).join(''); // Re-bind add-to-cart listeners after render document.querySelectorAll('.add-to-cart').forEach(btn => { btn.addEventListener('click', async () => { try { const id = btn.dataset.id; const res = await fetch('/api/cart/add', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id }), }); if (!res.ok) throw new Error(`HTTP ${res.status}`); const data = await res.json(); window.fourwash && window.fourwash.showToast(data.message); window.fourwash && window.fourwash.fetchCart(); } catch (err) { console.error('Add to cart failed:', err); } }); }); } catch (err) { console.error('Failed to load products:', err); document.getElementById('product-grid').innerHTML = '

Could not load products. Please try again later.

'; } })();