@adobe/fetch
Advanced tools
Comparing version 0.1.2 to 0.1.4
@@ -70,3 +70,3 @@ /* | ||
*/ | ||
function adobefetch(url, options = {}, configOptions, tokenCache) { | ||
function adobefetch(url, options, configOptions, tokenCache) { | ||
return _fetch(url, options, configOptions, tokenCache, false); | ||
@@ -73,0 +73,0 @@ } |
{ | ||
"name": "@adobe/fetch", | ||
"version": "0.1.2", | ||
"version": "0.1.4", | ||
"description": "Call Adobe APIs", | ||
@@ -23,3 +23,6 @@ "main": "index.js", | ||
"jwt", | ||
"api" | ||
"api", | ||
"fetch", | ||
"adobe", | ||
"adobeio" | ||
], | ||
@@ -26,0 +29,0 @@ "author": "Adobe Inc.", |
@@ -0,1 +1,2 @@ | ||
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) | ||
[![Version](https://img.shields.io/npm/v/@adobe/fetch.svg)](https://npmjs.org/package/@adobe/fetch) | ||
@@ -6,4 +7,5 @@ [![Downloads/week](https://img.shields.io/npm/dw/@adobe/fetch.svg)](https://npmjs.org/package/@adobe/fetch) | ||
[![codecov](https://codecov.io/gh/adobe/adobe-fetch/branch/master/graph/badge.svg)](https://codecov.io/gh/adobe/adobe-fetch) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/adobe/adobe-fetch.svg)](https://greenkeeper.io/) | ||
# adobeio-fetch | ||
# adobe-fetch | ||
@@ -10,0 +12,0 @@ Call Adobe APIs |
@@ -25,8 +25,5 @@ /* eslint-disable require-atomic-updates */ | ||
async function readCache(cache) { | ||
if (cache.disableStorage) { | ||
if (cache.tokens === undefined) { | ||
cache.tokens = {}; | ||
} | ||
} else { | ||
cache.tokens = (await storage.read()) || {}; | ||
if (!cache.disableStorage) { | ||
cache.tokens = await storage.read(); | ||
cache.readOnce = true; | ||
} | ||
@@ -80,4 +77,3 @@ } | ||
let cacheRead = false; | ||
if (cache.tokens === undefined) { | ||
cache.tokens = {}; | ||
if (!cache.readOnce) { | ||
await readCache(cache); | ||
@@ -97,5 +93,7 @@ cacheRead = true; | ||
function config(options) { | ||
const disableStorage = (options && options.disableStorage) || false; | ||
const cache = { | ||
disableStorage: (options && options.disableStorage) || false, | ||
tokens: undefined | ||
disableStorage: disableStorage, | ||
readOnce: disableStorage, | ||
tokens: {} | ||
}; | ||
@@ -102,0 +100,0 @@ |
@@ -26,8 +26,6 @@ /* | ||
*/ | ||
async function _initStorage(options = {}) { | ||
async function _initStorage() { | ||
// Make sure init is only called once. | ||
if (!storagePromise) { | ||
storagePromise = storage | ||
.init(options) | ||
.then(() => (storageInitialized = true)); | ||
storagePromise = storage.init().then(() => (storageInitialized = true)); | ||
} | ||
@@ -34,0 +32,0 @@ return storagePromise; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
84056
20858
26
114
651