@availity/api-core
Advanced tools
Comparing version 6.0.3 to 6.0.4-alpha.0
{ | ||
"name": "@availity/api-core", | ||
"version": "6.0.3", | ||
"version": "6.0.4-alpha.0+9350765", | ||
"description": "Base API definitions for the Availity REST API", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "c21c54fe3e92327f06069597a26ecc691b266b54" | ||
"gitHead": "93507657b78a68ff431e92f0bd3336b74e2199c4" | ||
} |
@@ -197,2 +197,25 @@ import * as avLocalStorage from '@availity/localstorage-core'; | ||
sendBeacon(data, config) { | ||
if (!data) { | ||
throw new Error('called method without [data]'); | ||
} | ||
config = this.config(config); | ||
config.method = 'POST'; | ||
config.url = this.getUrl(config); | ||
config.data = data; | ||
const beforeFunc = this.beforeCreate || this.beforePost; | ||
if (beforeFunc) { | ||
config.data = beforeFunc(config.data); | ||
} | ||
if (navigator.sendBeacon) { | ||
const result = navigator.sendBeacon(config.url, config.data); | ||
// A truthy return value from navigator.sendBeacon means the browser successfully queued the request | ||
if (result) return this.Promise.resolve(); | ||
} | ||
// Fall back to XHR if browser does not support navigator.sendBeacon or browser fails to queue the request | ||
return this.request(config, this.afterCreate || this.afterPost); | ||
} | ||
post(data, config) { | ||
@@ -199,0 +222,0 @@ return this.create(data, config); |
import AvApi from '../api'; | ||
import flattenObject from '../flattenObject'; | ||
@@ -19,20 +20,25 @@ export default class AvLogMessages extends AvApi { | ||
delete entries.level; | ||
return { level, entries }; | ||
const payload = { level, entries }; | ||
const flattened = flattenObject(payload); | ||
return Object.keys(flattened).reduce((accum, key) => { | ||
accum.append(key, flattened[key]); | ||
return accum; | ||
}, new FormData()); | ||
} | ||
debug(entries) { | ||
return this.create(this.send('debug', entries)); | ||
return this.sendBeacon(this.send('debug', entries)); | ||
} | ||
info(entries) { | ||
return this.create(this.send('info', entries)); | ||
return this.sendBeacon(this.send('info', entries)); | ||
} | ||
warn(entries) { | ||
return this.create(this.send('warn', entries)); | ||
return this.sendBeacon(this.send('warn', entries)); | ||
} | ||
error(entries) { | ||
return this.create(this.send('error', entries)); | ||
return this.sendBeacon(this.send('error', entries)); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53691
30
986
2
1