useQuery error

const { data: user, isError } = trpc.userInfo.getUser.useQuery(
[reactQueryKeys.currentUser],
{
onSuccess: (data) => {
console.log("sadfdfhhsdf");
console.log(data);
// if (status === 200) {
// setUser(data);
// } else if (status == 404 || status == 422) {
// router.push("/usernotfound");
// }
setUser(data);
},
onError: () => {
toast.error("An error occured while getting your data", {
position: toast.POSITION.BOTTOM_RIGHT,
});
},
}
);
const { data: user, isError } = trpc.userInfo.getUser.useQuery(
[reactQueryKeys.currentUser],
{
onSuccess: (data) => {
console.log("sadfdfhhsdf");
console.log(data);
// if (status === 200) {
// setUser(data);
// } else if (status == 404 || status == 422) {
// router.push("/usernotfound");
// }
setUser(data);
},
onError: () => {
toast.error("An error occured while getting your data", {
position: toast.POSITION.BOTTOM_RIGHT,
});
},
}
);
4 Replies
shikishikichangchang
I'm getting the error Argument of type 'string[]' is not assignable to parameter of type 'void'.ts(2345) Using regular RQ, it works fine but trpc useQuery throws an error
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Neto
Neto3y ago
Is the input a array?
shikishikichangchang
Which input? reactQueryKeys.currentUser is a string [reactQueryKeys.currentUser] makes it a string array
Want results from more Discord servers?
Add your server