0.0.3 • Published 2 years ago

angular-trpc v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago