pikax / vue-composable

Vue composition-api composable components. i18n, validation, pagination, fetch, etc. +50 different composables
https://pikax.me/vue-composable/
MIT License
1.18k stars 64 forks source link

Feat/add axios composable #1008

Open damienroche opened 3 years ago

damienroche commented 3 years ago

Hi there, it would be nice to have access to a boolean like isFinished (like in vueUse/useAxios ) to indicates if the request is finished. For example, this boolean can be useful is this case :


<template>
  <div>
    <div v-if="isFinished && items.length === 0>
      No items in database
      <button @click="createItem">Create your fist item</button>
    </div>
    <ul v-else>
      <li v-for="item in items">
        ....
      </li>
    </ul>
  </div>
</template>

<script lang="ts" setup>
const items = ref([])
const { isFinished, exec } = useAxios()
...
</script>