swikarrr
swikarrr
TTCTheo's Typesafe Cult
Created by swikarrr on 7/9/2023 in #questions
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");
}
}
},
});
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 ?
8 replies
TTCTheo's Typesafe Cult
Created by swikarrr on 7/8/2023 in #questions
TypeScript
Hi guys i am trying to learn TypeScript. Is there any good resources you can suggest besides the documentation ?
6 replies