Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4c3a67

Browse files
committed
Change the query key for all-goals-by-user
1 parent 49e2f4a commit f4c3a67

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/components/goals/NewGoal.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ export default function NewGoal() {
4040
toast.success('You have successfully set your goal.', {
4141
id: toastId.current,
4242
})
43-
queryClient.refetchQueries([
44-
'/api/fauna/goals/all-goals-by-user',
45-
(session.user as User).id,
46-
])
43+
queryClient.refetchQueries('/api/fauna/goals/all-goals-by-user')
4744
queryClient.refetchQueries('/api/fauna/goals/get-current-goal')
4845
},
4946
onError: () => {

src/pages/[username]/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function UserProfile({
4141
}: InferGetServerSidePropsType<typeof getServerSideProps>) {
4242
const [session, loading] = useSession()
4343
const { isLoading, isError, data } = useQuery(
44-
['/api/fauna/goals/all-goals-by-user', user.id],
44+
'/api/fauna/goals/all-goals-by-user',
4545
() =>
4646
fetch(`/api/fauna/goals/all-goals-by-user`, {
4747
method: 'POST',

0 commit comments

Comments
 (0)