WO
WO
Explore posts from servers
TTCTheo's Typesafe Cult
Created by WO on 8/4/2023 in #questions
How to refetch data for a query when a mutation is performed in a different component?
I’ve been looking through the docs on tRPC and React Query but can’t quite figure this out. To give a quick explanation of what I’m trying to do, I’m creating a system where a user can request to join a group and then the admins can accept or decline the request. Component A is fetching the request status on the user side through a useQuery on one of my tRPC procedures. Component B performs a mutation (accept or decline) on the admin side from one of my tRPC procedures and I want it to immediately update the request status that the user sees in Component A after the admin accepts or declines. I’ve tried messing with refetchQueries() and invalidateQueries() in the onSuccess of the mutation but have had no luck.
13 replies
TTCTheo's Typesafe Cult
Created by WO on 6/27/2023 in #questions
How to allow 3rd party apps to send POST requests to your API
I'm exporting data from a 3rd party app which sends a POST request to an api in my app. The problem is it works when I test it locally by exposing my local port through ngrok but when I deploy to Vercel my endpoint doesn't get hit at all and I get an error from the 3rd party app with a not so helpful error message. I've explored messing with CORS but that didn't fix it, assuming that I'm modifying the CORS settings correctly.
43 replies
TTCTheo's Typesafe Cult
Created by WO on 5/18/2023 in #questions
How do I setup a base api url for the preview environment when deploying to Vercel?
New to Next and working with API routes. My API routes are working locally when I use http://localhost:3000/api as the base URL but how would I create a base url for the preview environment since the url is dynamic?
7 replies