feat(product): trigger product list refresh on product creation event

This commit is contained in:
Nils-Johan Gynther
2026-04-19 19:22:46 +02:00
parent 829b7a80fc
commit a7680b40af
2 changed files with 7 additions and 3 deletions
@@ -69,6 +69,12 @@ export default function AdminProductList() {
refetchProducts();
}, [refetchProducts]);
useEffect(() => {
const handler = () => refetchProducts();
window.addEventListener('product-created', handler);
return () => window.removeEventListener('product-created', handler);
}, [refetchProducts]);
useEffect(() => {
fetch('/api/categories')
.then((r) => r.json())