fix _getCached
This commit is contained in:
parent
f179cfe3c9
commit
356a2d3131
|
@ -397,8 +397,7 @@
|
||||||
directives: {
|
directives: {
|
||||||
get: function (providerUri) {
|
get: function (providerUri) {
|
||||||
providerUri = OAUTH3.uri.normalize(providerUri);
|
providerUri = OAUTH3.uri.normalize(providerUri);
|
||||||
if (!OAUTH3.hooks.directives._cache) { OAUTH3.hooks.directives._cache = {}; }
|
return OAUTH3.PromiseA.resolve(OAUTH3.hooks.directives._getCached(providerUri)
|
||||||
return OAUTH3.PromiseA.resolve(OAUTH3.hooks.directives._cache[providerUri]
|
|
||||||
|| OAUTH3.hooks.directives._get(providerUri))
|
|| OAUTH3.hooks.directives._get(providerUri))
|
||||||
.then(function (directives) {
|
.then(function (directives) {
|
||||||
// or do .then(this._set) to keep DRY?
|
// or do .then(this._set) to keep DRY?
|
||||||
|
@ -408,6 +407,7 @@
|
||||||
}
|
}
|
||||||
, _getCached: function (providerUri) {
|
, _getCached: function (providerUri) {
|
||||||
providerUri = OAUTH3.uri.normalize(providerUri);
|
providerUri = OAUTH3.uri.normalize(providerUri);
|
||||||
|
if (!OAUTH3.hooks.directives._cache) { OAUTH3.hooks.directives._cache = {}; }
|
||||||
return OAUTH3.hooks.directives._cache[providerUri];
|
return OAUTH3.hooks.directives._cache[providerUri];
|
||||||
}
|
}
|
||||||
, set: function (providerUri, directives) {
|
, set: function (providerUri, directives) {
|
||||||
|
@ -511,6 +511,7 @@
|
||||||
}
|
}
|
||||||
, _getCached: function (providerUri) {
|
, _getCached: function (providerUri) {
|
||||||
providerUri = OAUTH3.uri.normalize(providerUri);
|
providerUri = OAUTH3.uri.normalize(providerUri);
|
||||||
|
if (!OAUTH3.hooks.session._cache) { OAUTH3.hooks.session._cache = {}; }
|
||||||
return OAUTH3.hooks.session._cache[providerUri];
|
return OAUTH3.hooks.session._cache[providerUri];
|
||||||
}
|
}
|
||||||
, set: function (providerUri, newSession) {
|
, set: function (providerUri, newSession) {
|
||||||
|
@ -528,9 +529,8 @@
|
||||||
if (!providerUri) {
|
if (!providerUri) {
|
||||||
throw new Error("providerUri is not set");
|
throw new Error("providerUri is not set");
|
||||||
}
|
}
|
||||||
if (!OAUTH3.hooks.session._cache) { OAUTH3.hooks.session._cache = {}; }
|
|
||||||
|
|
||||||
return OAUTH3.PromiseA.resolve(OAUTH3.hooks.session._cache[providerUri]
|
return OAUTH3.PromiseA.resolve(OAUTH3.hooks.session._getCached(providerUri)
|
||||||
|| OAUTH3.hooks.session._get(providerUri)).then(function (session) {
|
|| OAUTH3.hooks.session._get(providerUri)).then(function (session) {
|
||||||
OAUTH3.hooks.session._cache[providerUri] = session;
|
OAUTH3.hooks.session._cache[providerUri] = session;
|
||||||
return session;
|
return session;
|
||||||
|
|
Loading…
Reference in New Issue