How to use the react-relay-network-modern/es.authMiddleware function in react-relay-network-modern

To help you get started, we’ve selected a few react-relay-network-modern examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coralproject / talk / src / core / client / framework / lib / network / createNetwork.ts View on Github external
}),
      urlMiddleware({
        url: () => Promise.resolve(graphqlURL),
      }),
      retryMiddleware({
        fetchTimeout: 15000,
        retryDelays: (attempt: number) => Math.pow(2, attempt + 4) * 100,
        // or simple array [3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600],
        statusCodes: [500, 503, 504],
        beforeRetry: ({ abort, attempt }) => {
          if (attempt > 2) {
            abort();
          }
        },
      }),
      authMiddleware({
        token: tokenGetter,
      }),
      clientIDMiddleware(clientID),
      persistedQueriesGetMethodMiddleware,
    ],
    { subscribeFn: createSubscriptionFunction(subscriptionClient) }
  );
}