fix(catégorie-produits) corrige l'affichage et le fonctionnement

This commit is contained in:
gcch 2024-10-27 11:52:03 +01:00
commit 4dd34abcb2
35 changed files with 112 additions and 75 deletions

View file

@ -1,7 +1,7 @@
import { z, N } from "./index.CeK6pfoJ.js";
import { p as parse } from "./index.Dco04HYW.js";
import { R as ROUTE_API_NOUVELLE_PRODUCTS } from "./api.js";
import { f as SELECTEUR_GRILLE_PRODUITS, g as SELECTEUR_BOUTON_PLUS_PRODUITS, h as ATTRIBUT_PAGE, i as ATTRIBUT_HIDDEN } from "./dom.js";
import { f as SELECTEUR_GRILLE_PRODUITS, g as SELECTEUR_BOUTON_PLUS_PRODUITS, h as ATTRIBUT_ID_CATEGORIE_PRODUITS, i as ATTRIBUT_PAGE, j as ATTRIBUT_HIDDEN } from "./dom.js";
import { h as html } from "./dom2.js";
import { l as leveServerError } from "./erreurs.js";
import { e as estReponse500 } from "./gardes.js";
@ -19,11 +19,14 @@ const ETATS_PAGE = _etats;
const GRILLE_PRODUITS = recupereElementDansDocumentOuLeve(SELECTEUR_GRILLE_PRODUITS);
const BOUTON_PLUS_DE_PRODUITS = recupereElementDansDocumentOuLeve(SELECTEUR_BOUTON_PLUS_PRODUITS);
const initialisePageBoutique = () => {
const idCategorieProduits = GRILLE_PRODUITS.getAttribute(ATTRIBUT_ID_CATEGORIE_PRODUITS);
BOUTON_PLUS_DE_PRODUITS.addEventListener("click", () => {
const nouvellePage = Number(GRILLE_PRODUITS.getAttribute(ATTRIBUT_PAGE)) + 1;
const args = {
page: nouvellePage,
per_page: 13
per_page: 13,
// Ajoute conditionnellement la Catégorie de Produits
...idCategorieProduits && { category: idCategorieProduits }
};
Either.encase(() => parse(WCV3ProductsArgsSchema, args)).map(
async (args2) => {