@dfinity/auth-client
Advanced tools
Comparing version 0.15.6 to 0.15.7
@@ -195,3 +195,3 @@ "use strict"; | ||
} | ||
_handleSuccess(message, onSuccess) { | ||
async _handleSuccess(message, onSuccess) { | ||
var _a, _b, _c; | ||
@@ -222,5 +222,10 @@ const delegations = message.delegations.map(signedDelegation => { | ||
} | ||
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(); | ||
this._removeEventListener(); | ||
delete this._idpWindow; | ||
if (this._chain) { | ||
await this._storage.set(storage_1.KEY_STORAGE_DELEGATION, JSON.stringify(this._chain.toJSON())); | ||
} | ||
// onSuccess should be the last thing to do to avoid consumers | ||
// interfering by navigating or refreshing the page | ||
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(); | ||
} | ||
@@ -312,9 +317,3 @@ getIdentity() { | ||
try { | ||
this._handleSuccess(message, options === null || options === void 0 ? void 0 : options.onSuccess); | ||
// Setting the storage is moved out of _handleSuccess to make | ||
// it a sync function. Having _handleSuccess as an async function | ||
// messes up the jest tests for some reason. | ||
if (this._chain) { | ||
await this._storage.set(storage_1.KEY_STORAGE_DELEGATION, JSON.stringify(this._chain.toJSON())); | ||
} | ||
await this._handleSuccess(message, options === null || options === void 0 ? void 0 : options.onSuccess); | ||
} | ||
@@ -321,0 +320,0 @@ catch (err) { |
@@ -173,3 +173,3 @@ /** @module AuthClient */ | ||
} | ||
_handleSuccess(message, onSuccess) { | ||
async _handleSuccess(message, onSuccess) { | ||
var _a, _b, _c; | ||
@@ -200,5 +200,10 @@ const delegations = message.delegations.map(signedDelegation => { | ||
} | ||
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(); | ||
this._removeEventListener(); | ||
delete this._idpWindow; | ||
if (this._chain) { | ||
await this._storage.set(KEY_STORAGE_DELEGATION, JSON.stringify(this._chain.toJSON())); | ||
} | ||
// onSuccess should be the last thing to do to avoid consumers | ||
// interfering by navigating or refreshing the page | ||
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(); | ||
} | ||
@@ -290,9 +295,3 @@ getIdentity() { | ||
try { | ||
this._handleSuccess(message, options === null || options === void 0 ? void 0 : options.onSuccess); | ||
// Setting the storage is moved out of _handleSuccess to make | ||
// it a sync function. Having _handleSuccess as an async function | ||
// messes up the jest tests for some reason. | ||
if (this._chain) { | ||
await this._storage.set(KEY_STORAGE_DELEGATION, JSON.stringify(this._chain.toJSON())); | ||
} | ||
await this._handleSuccess(message, options === null || options === void 0 ? void 0 : options.onSuccess); | ||
} | ||
@@ -299,0 +298,0 @@ catch (err) { |
{ | ||
"name": "@dfinity/auth-client", | ||
"version": "0.15.6", | ||
"version": "0.15.7", | ||
"author": "DFINITY Stiftung <sdk@dfinity.org>", | ||
@@ -50,5 +50,5 @@ "license": "Apache-2.0", | ||
"peerDependencies": { | ||
"@dfinity/agent": "^0.15.6", | ||
"@dfinity/identity": "^0.15.6", | ||
"@dfinity/principal": "^0.15.6" | ||
"@dfinity/agent": "^0.15.7", | ||
"@dfinity/identity": "^0.15.7", | ||
"@dfinity/principal": "^0.15.7" | ||
}, | ||
@@ -55,0 +55,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
264414
1999