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,
        });
      },
    }
  );
Was this page helpful?