Skip to content

Commit

Permalink
docs(useFetch): Fixing demo for storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
microcipcip committed Apr 26, 2020
1 parent f6de30e commit 584bc1a
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions src/functions/useFetch/stories/UseFetchDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,10 @@
:disabled="isLoading"
v-text="`Fetch with failure`"
/>
<button
class="button is-danger"
@click="stop"
:disabled="!isLoading"
v-text="`Abort fetch`"
/>
</div>

<!-- isAborted -->
<use-fetch-demo-table status="Aborted" v-if="isAborted">
Resource fetch aborted with status code
<strong>{{ status }}</strong> and message
<strong>{{ statusText }}</strong>
</use-fetch-demo-table>

<!-- isFailed -->
<use-fetch-demo-table status="Failed" v-else-if="isFailed">
<use-fetch-demo-table status="Failed" v-if="isFailed">
Resource fetch failed with status code
<strong>{{ status }}</strong> and message
<strong>{{ statusText }}</strong>
Expand Down Expand Up @@ -71,16 +58,14 @@ export default Vue.extend({
components: { UseFetchDemoTable },
setup() {
const isInit = ref(false)
const delayUrl = 'http://deelay.me/2000'
const randomDogUrl = `${delayUrl}/https://dog.ceo/api/breeds/image/random`
const randomDogUrl = 'https://dog.ceo/api/breeds/image/random'
const url = ref(randomDogUrl)
const {
data,
status,
statusText,
isLoading,
isFailed,
isAborted,
start,
stop
} = useFetch(url, {}, false)
Expand All @@ -93,7 +78,7 @@ export default Vue.extend({
const startWithFailed = () => {
isInit.value = true
url.value = `${delayUrl}/https://dog.ceo`
url.value = 'https://dog.ceo'
start()
}
Expand All @@ -104,7 +89,6 @@ export default Vue.extend({
isInit,
isLoading,
isFailed,
isAborted,
startWithSuccess,
startWithFailed,
stop
Expand Down

0 comments on commit 584bc1a

Please sign in to comment.