From f42aede4400389f020a979be5ed3486bbf6ac82f Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Tue, 2 May 2023 22:35:01 +0200 Subject: [PATCH] chore(docs): use promise.all to fetch counters Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- docs/components/home/Banner.vue | 19 ++++++++++--------- .../src/composables/useGetPointerPosition.ts | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/components/home/Banner.vue b/docs/components/home/Banner.vue index 1e2105db..dbc75357 100644 --- a/docs/components/home/Banner.vue +++ b/docs/components/home/Banner.vue @@ -3,9 +3,9 @@ import { $fetch } from 'ohmyfetch' import Star from '~icons/carbon/star' import Download from '~icons/carbon/download' -const starGazersCount = ref(0) +const starGazersCount = ref(1000) -const downloadCount = ref(0) +const downloadCount = ref(10000) const starGazersCountTransitioned = useTransition(starGazersCount, { duration: 1000, @@ -21,13 +21,14 @@ const downloadCountTransitioned = useTransition(downloadCount, { }, }) -$fetch('https://api.github.com/repos/bcakmakoglu/vue-flow?page=$i&per_page=100').then((data) => { - starGazersCount.value = data.stargazers_count -}) - -$fetch('https://api.npmjs.org/downloads/point/last-month/@vue-flow/core').then((data) => { - downloadCount.value = data.downloads -}) +Promise.all([ + $fetch('https://api.github.com/repos/bcakmakoglu/vue-flow?page=$i&per_page=100').then((data) => { + starGazersCount.value = data.stargazers_count + }), + $fetch('https://api.npmjs.org/downloads/point/last-month/@vue-flow/core').then((data) => { + downloadCount.value = data.downloads + }), +])