Wondering what’s next for npm?Check out our public roadmap! »

@unbill/ui-utils

1.7.5 • Public • Published

ui-utils

Common UI functionality used across multiple BDCS UI projects

Environment

import { environment } from '@unbill/ui-utils'
 
// Gets the current environment production/sandbox/staging/development
environment.getEnvironment(document.location.hostname)
 
// Gets the API Root of the core API (tentacles)
environment.getCoreApiRoot('development')

Http

// Setup
import { http } from '@unbill/ui-utils'
Vue.Use(http, options)
 
// Usage
// Options is optional and will use the options passed into the plugin or default options
http.get(url, options)
http.post(url, body, options)
http.delete(url, options)
http.put(url, body, options)

Http Options

// Options and their default values
const options = {
  retryHttpStatii: [502, 503, 504],
  retryMethods: ['get'], //get, post, put, delete supported
  maxRetries: 4,
  retryDelay: 500, //milliseconds with backoff for each successive try
  backOffStrategy: backOffStrategies.Additive //None, Additive, Exponential
  onBefore: [] //Function or array of functions to call before http calls. Don't take parameters.
}

When a response receives an error code, it will automatically throw the response as an error.
To prevent this, in your response handling set suppressThrow on the response object itself to a truthy value.

Keywords

none

Install

npm i @unbill/ui-utils

DownloadsWeekly Downloads

0

Version

1.7.5

License

ISC

Unpacked Size

9 kB

Total Files

7

Last publish

Collaborators

  • avatar