How to use the @vtex/api.CacheType.None function in @vtex/api

To help you get started, we’ve selected a few @vtex/api 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 vtex / toolbelt / src / clients / Builder.ts View on Github external
public availability = async (app: string, hintIndex: number) => {
    const stickyHint =
      hintIndex === undefined || hintIndex === null
        ? `request:${this.context.account}:${this.context.workspace}:${app}`
        : `request:${this.context.account}:${this.context.workspace}:${app}:${hintIndex}`
    const headers = {
      'Content-Type': 'application/json',
      'x-vtex-sticky-host': stickyHint,
    }
    const metric = 'bh-availability'
    const {
      data: { availability },
      headers: { 'x-vtex-sticky-host': host },
    } = await this.http.getRaw(routes.availability(app), { headers, metric, cacheable: CacheType.None })
    const { hostname, score } = availability as AvailabilityResponse
    return { host, hostname, score }
  }