refactor: removing useAsyncData for tanstack query (#5262)
* refactor: most places with useAsyncData replaced with tanstack query * refactor report list and report view * refactor organization page to use tanstack query * fix types * refactor collection page and include proper loading state * fix followed projects proper loading state * fix 404 handling * fix organization loading and 404 states * pnpm prepr * refactor: remove useAsyncData on newsletter button * refactor: remove useAsyncData on auth globals fetch * refactor: settings/billing/index.vue to useQuery instead of useAsyncData * refactor: user page to remove useAsyncData * pnpm prepr * fix reports pages * fix notifications page * fix billing page cannot read properties of null and prop warnings * fix refresh causing 404 by removing useBaseFetch and use api-client * fix stale data after removing organization from project * pnpm prepr * fix news erroring in build * fix: project page loads header only after content * fix: user page tanstack problems (start on migrating away from useBaseFetch) * fix: start swapping useBaseFetch usages to api-client * Revert "fix: start swapping useBaseFetch usages to api-client" This reverts commit 3df3fab11d535159132b1288dd7cacc38282b553. * fix: remove debug logging * fix: lint --------- Co-authored-by: Calum H. <calum@modrinth.com> Co-authored-by: Calum H. (IMB11) <contact@cal.engineer>
This commit is contained in:
@@ -163,6 +163,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { StyledInput, useFormatDateTime, useFormatMoney } from '@modrinth/ui'
|
||||
import { useQuery } from '@tanstack/vue-query'
|
||||
import dayjs from 'dayjs'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
@@ -188,11 +189,13 @@ const selectedDate = computed(() => dayjs(rawSelectedDate.value))
|
||||
const endOfMonthDate = computed(() => selectedDate.value.endOf('month'))
|
||||
const withdrawalDate = computed(() => endOfMonthDate.value.add(60, 'days'))
|
||||
|
||||
const { data: transparencyInformation } = await useAsyncData('payout/platform_revenue', () =>
|
||||
useBaseFetch('payout/platform_revenue', {
|
||||
apiVersion: 3,
|
||||
}),
|
||||
)
|
||||
const { data: transparencyInformation } = useQuery({
|
||||
queryKey: ['payout', 'platform_revenue'],
|
||||
queryFn: () =>
|
||||
useBaseFetch('payout/platform_revenue', {
|
||||
apiVersion: 3,
|
||||
}),
|
||||
})
|
||||
|
||||
const platformRevenue = (transparencyInformation.value as any)?.all_time
|
||||
const platformRevenueData = (transparencyInformation.value as any)?.data?.slice(0, 5) ?? []
|
||||
|
||||
Reference in New Issue
Block a user