0.0.3 • Published 11 months ago
angular-trpc v0.0.3
angular-trpc
How to use
Basic example
const { provideFn: provideTRPCClient, injectFn: injectTRPC } = createTRPCAngularClient<AppRouter>();
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(appRoutes, withEnabledBlockingInitialNavigation()),
provideTRPCClient(
{
url: '<Your tRPC endpoint here>',
},
// Optional
withCredentials({ credentials: 'include' }),
withHeaders({ headers: () => ({ Authorization: 'test' }) })
),
],
};
Available configuration
The client can be configured by using following configuration function
withHeaders
provideTRPCClient(
{
url: '<your tRPC endpoint>',
},
withHeaders({ headers: () => ({ Authorization: 'TOKEN' }) })
);
withCredentials
provideTRPCClient(
{
url: '<your tRPC endpoint>',
},
withCredentials({ credentials: 'include' })
);