JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q36142F
  • License MIT

Package Exports

  • swagger-to-react-query

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (swagger-to-react-query) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

swagger-to-react-query WIP

Try

$ git clone https://github.com/elsangedy/swagger-to-react-query.git
$ cd swagger-to-react-query/examples
$ node ../src/index config.js
$ // or
$ npx swagger-to-react-query config.js
const addToken = (request) => {
  const token = authService.getToken()
  if (token) {
    request.headers.set('authorization', `Bearer ${token}`)
  }
}
const refreshToken = async ({ request }) => {
  try {
    await authService.refreshToken()
    addToken(request)
  } catch (e) {
    authService.logout()
  }
}

// https://github.com/sindresorhus/ky
extendApi({
  prefixUrl: API_URL,
  hooks: {
    beforeRequest: [addToken],
    beforeRetry: [refreshToken],
  },
})