PageSourceSearch

https://www.label-emmaus.co/static/js/alpine/custom/favoris/trashButton.js?v=615087a581

js label-emmaus.co collected 2026-09-24 18:59:59 UTC 1,712 bytes, 52 lines download raw bytes

1document.addEventListener('alpine:init', () => {
2  Alpine.data('favorisTrashButton', ({ offerId, productId, url }) => ({
3    loading: false,
4    remove() {
5      if (this.loading) {
6        return;
7      }
8      const card = this.$root.closest('.product-card');
9      if (!card) {
10        console.error('favorisTrashButton: parent .product-card not found');
11        return;
12      }
13      this.loading = true;
14      axios
15        .post(url, null, {
16          withCredentials: true,
17          headers: { 'X-CSRFToken': readCsrfToken() },
18        })
19        .then((response) => {
20          if (response.status !== 200) {
21            this._error();
22            return;
23          }
24          window.dispatchEvent(
25            new CustomEvent('favoris:remove', {
26              detail: {
27                productId: Number(productId) || null,
28                offerId: Number(offerId) || null,
29                cardElement: card,
30              },
31            })
32          );
33        })
34        .catch((error) => {
35          console.error(error);
36          this._error(error?.response?.data?.error);
37        });
38    },
39    _error(errorKey) {
40      this.loading = false;
41      if (typeof dispatchFavorisErrorToast === 'function') {
42        const copy =
43          (typeof FAVORIS_ERROR_COPY !== 'undefined' && FAVORIS_ERROR_COPY[errorKey]) ||
44          (typeof FAVORIS_ERROR_COPY !== 'undefined' && FAVORIS_ERROR_COPY.default) ||
45          'Une erreur est survenue lors de la suppression du favori.';
46        dispatchFavorisErrorToast(copy);
47      } else if (typeof openMessageDialog === 'function') {
48        openMessageDialog('Une erreur est survenue lors de la suppression du favori.', 'error');
49      }
50    },
51  }));
52});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.