Skip to content

Adding http header to trpc #349

Answered by nezi311
nezi311 asked this question in Q&A
Discussion options

You must be logged in to vote

nvm, figured it out.

createTrpcClient<AppRouter>({
  url: '/api/trpc',
});

returns an signal TrpcHeaders which we can set on .
TrpcHeaders.set({ Authorization: Bearer ${localStorage.getItem('token')} });

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nezi311
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant