Adrian Lysakowski
External calls
you could do a fetch, inside "server" component, instead of trpc, but then if ur logic later on in trpc actually depends on response, then it doesn't make sense to have call in component await and then pass it to trpc route 😄 as in my case once i got response i need to save those users in my db as well 😄 so it very valid to have it all together inside the method of trpc route
16 replies
External calls
@mfaizan1 it depends, if u call public extarnal API then it's fine, u can use react query, but if that's the request where u need to pass some "tokens" which are private ones, u can't use react query, as then me using ur app can steal it
16 replies
External calls
so the logic is
on UI
-> fill in user information
-> call trpc users route
create
method
on Server
-> method inside first try to create users in clerk using fetch
-> await response, check if all good
-> save created user in my db using with additional property clerkUserId
from the response of fetch16 replies