@liquid-state/iwa-cognito-identity
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -40,3 +40,3 @@ import { CognitoUserPool } from 'amazon-cognito-identity-js'; | ||
clear(): Promise<void>; | ||
private restoreSession(); | ||
private restoreSession(storedIdentity); | ||
private createUserSession(credentials); | ||
@@ -43,0 +43,0 @@ private refreshExpiredSession(); |
@@ -100,3 +100,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
if (!!this.session) return [3 /*break*/, 3]; | ||
return [4 /*yield*/, this.restoreSession()]; | ||
return [4 /*yield*/, this.restoreSession(storedIdentity)]; | ||
case 2: | ||
@@ -182,20 +182,16 @@ _a.sent(); | ||
}; | ||
CognitoIdentityProvider.prototype.restoreSession = function () { | ||
CognitoIdentityProvider.prototype.restoreSession = function (storedIdentity) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
var _a, identity, credentials; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, this.store.fetch(this.storeKey)]; | ||
case 1: | ||
_a = _b.sent(), identity = _a.identity, credentials = _a.credentials; | ||
if (!identity || !credentials) { | ||
return [2 /*return*/]; | ||
} | ||
this.session = this.createUserSession(credentials); | ||
// Restore identity. | ||
// Note that credentials provider is not configured yet | ||
this.identity = new AWSIdentity(identity, function () { return _this.credentialsProvider; }); | ||
return [2 /*return*/]; | ||
var identity, credentials; | ||
return __generator(this, function (_a) { | ||
identity = storedIdentity.identity, credentials = storedIdentity.credentials; | ||
if (!identity || !credentials) { | ||
return [2 /*return*/]; | ||
} | ||
this.session = this.createUserSession(credentials); | ||
// Restore identity. | ||
// Note that credentials provider is not configured yet | ||
this.identity = new AWSIdentity(identity, function () { return _this.credentialsProvider; }); | ||
return [2 /*return*/]; | ||
}); | ||
@@ -202,0 +198,0 @@ }); |
{ | ||
"name": "@liquid-state/iwa-cognito-identity", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
50002
717