Commit 83ea9561 authored by narendraR's avatar narendraR Committed by Tim Plunkett
Browse files

Issue #3278333 by narendraR, fjgarlin: Categories listing should read from...

Issue #3278333 by narendraR, fjgarlin: Categories listing should read from internal endpoint, not fixture
parent e8c1f02c
Loading
Loading
Loading
Loading
+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+11 −2
Changes for sveltejs/src/Filter.svelte: 11 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@

<script>
    import { createEventDispatcher, getContext } from "svelte";
    import category_list from '../../fixtures/category_list.json';
    const dispatch = createEventDispatcher();
    const stateContext = getContext("state");

@@ -52,6 +51,15 @@
        stateContext.setPage(0, 0);
        stateContext.setRows(detail.rows);
    }

    async function fetchAllCategories() {
      const response = await fetch(drupalSettings.project_browser.origin_url + "/drupal-org-proxy/categories");
      if (response.ok) {
        return await response.json();
      } else {
        return [];
      }
    }
</script>

<style>
@@ -80,11 +88,12 @@
<form class="views-exposed-form">
    <div class="views-exposed-form__item js-form-item form-item js-form-type-select form-type--select js-form-item-type form-item--type">
      <h2>Categories</h2>
      {#await fetchAllCategories() then category_list}
        {#each category_list as dt }

          <input type = "checkbox" id= {dt.tid} bind:group={category} on:change={onSelectCategory} value={dt.tid} >
          <label class="checkbox-label" for="{dt.tid}"> {dt.name}</label>
          <br>
        {/each}
      {/await}
    </div>
</form>