Skip to content

Commit 586d78f

Browse files
fix: update fetch implementation to use 'ofetch' for goal API calls
1 parent 7c9d0a7 commit 586d78f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dashboard/src/hooks/use-goal.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useQuery } from '@tanstack/react-query'
2-
import { $fetch } from '@/service/http'
2+
import { $fetch as publicFetch } from 'ofetch'
33

44
type GoalType = 'donation' | 'github_stars' | (string & {})
55

@@ -30,8 +30,10 @@ export function useCurrentGoal() {
3030
return useQuery({
3131
queryKey: ['current-goal'],
3232
queryFn: async () => {
33-
const response = await $fetch<Goal>('https://donate.pasarguard.org/api/v1/goal/current', {
33+
const response = await publicFetch<Goal>('https://donate.pasarguard.org/api/v1/goal/current', {
3434
method: 'GET',
35+
referrerPolicy: 'no-referrer',
36+
credentials: 'omit',
3537
})
3638
return response
3739
},
@@ -44,8 +46,10 @@ export function useAllGoals() {
4446
return useQuery({
4547
queryKey: ['all-goals'],
4648
queryFn: async () => {
47-
const response = await $fetch<GoalsResponse>('https://donate.pasarguard.org/api/v1/goal/list', {
49+
const response = await publicFetch<GoalsResponse>('https://donate.pasarguard.org/api/v1/goal/list', {
4850
method: 'GET',
51+
referrerPolicy: 'no-referrer',
52+
credentials: 'omit',
4953
})
5054
return response
5155
},

0 commit comments

Comments
 (0)