Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
7 replies
swikarrr

Updated data not being fetched in production.

Hey guys so i just made a web app which uses prisma / planetscale and tanstack query.

I have been trying to fetch data from the code below

 const { data, refetch, isRefetching } = useQuery({
    queryKey: ["normal_fetch"],
    queryFn: async () => {
      const { data } = await axios.get("/api/votes/fetchVote");
      return data as VoteProps[];
    },
    onError: (err) => {
      if (err instanceof AxiosError) {
        if (err.response?.status === 401) {
          return console.log("errror");
        }
      }
    },
  });


It works perfectly fine in the local enviroment but the deployed version of the app doesn't fetch the updated data from database at all what might be the problem here ?
Was this page helpful?