Skip to content

Concept of buildFetch() #23

@krutoo

Description

@krutoo

Draft

import { buildFetch } from '@krutoo/fetch-tools';

const myFetch = buildFetch({
  fetch: fetch,

  retry: {
    count: 3,
  },

  jwt: {
    token: () => getTokenFromSomewhere(),
  },

  log: {
    onCatch: ({ error }) => {
      Sentry.sendEvent(error)
    },
  },

  defaultHeaders: {
    headers: {/* ... */},
    strategy: 'append',
  },

  middleware: getDefaults => getDefaults().concat(myCustomMiddleware),
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions