Skip to content

lewis-wow/svelte-fetchable

Repository files navigation

svelte fetchable

npm i svelte-fetchable
<script>
  import fetchable from 'svelte-fetchable'

  const [resultFetch, loadingFetch] = fetchable.post('https://jsonplaceholder.typicode.com/posts')
</script>

<main>
 <div>
    {#if $loadingFetch}
      <span>loading...</span>
    {:else}
      <span>result: {JSON.stringify($resultFetch)}</span>
    {/if}

    <br />
    <button on:click={() => resultFetch.fetch({ username: 'John Doe' })}>Fetch</button>
    <br />
    <button on:click={resultFetch.abort}>Abort</button>
  </div>
</main>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published