0.0.3 • Published 11 months ago

angular-trpc v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

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' })
);
0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago