🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

angular-trpc

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-trpc

Angular tRPC client

latest
Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

angular

FAQs

Package last updated on 21 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts