Efficient way to use tRPC client with auth headers from secure storage
Wondering if anyone has a recommended pattern on caching the deviceId / authHeader using a React Context instead of fetching it async on each request.
Thanks!
2 Replies
You could do an auth link before
That could cache it
Look at custom links
I tried to do this and was unable to make an async call in the auth link to fetch the headers. any advice?
and could you possible give a more fleshed out example of how this would work? Thanks!