Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "co-auther", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/co-auther/co-auther.js", |
var dontTouchLocalStorage = false; | ||
var terminalRoute = null; | ||
var initialRequestFailed = false; | ||
var coAuther; | ||
@@ -46,3 +47,3 @@ function basicRouting(afterHash) { | ||
canActivate = currentPage === destinationRoute; | ||
if (!initialRequestPending) { | ||
if (!initialRequestPending && !initialRequestFailed) { | ||
initialRequestPending = true; | ||
@@ -59,4 +60,5 @@ getCoAuther().makeInitialRequestWrap() | ||
.catch(function () { | ||
// initial request failed, clear auth data from login and go to authenticate | ||
initialRequestPending = false; | ||
// initial request failed, clear auth data from login and go to authenticate | ||
initialRequestFailed = true; | ||
clearAuthData(); | ||
@@ -66,2 +68,5 @@ return routeFunction(config.AUTHENTICATE); | ||
} | ||
else if (initialRequestFailed && authData) { | ||
console.error('You have manual authData management but haven\'t cleared it manually after failed initialRequest'); | ||
} | ||
} | ||
@@ -94,2 +99,3 @@ if (!canActivate) { | ||
} | ||
initialRequestFailed = false; // reset this one | ||
return apiService.login.apply(apiService, args) | ||
@@ -96,0 +102,0 @@ .then(function (res) { |
let dontTouchLocalStorage = false | ||
let terminalRoute = null | ||
let initialRequestFailed = false | ||
let coAuther | ||
@@ -44,3 +45,3 @@ function basicRouting (afterHash) { | ||
canActivate = currentPage === destinationRoute | ||
if (!initialRequestPending) { | ||
if (!initialRequestPending && !initialRequestFailed) { | ||
initialRequestPending = true | ||
@@ -57,7 +58,10 @@ getCoAuther().makeInitialRequestWrap() | ||
.catch(() => { | ||
// initial request failed, clear auth data from login and go to authenticate | ||
initialRequestPending = false | ||
// initial request failed, clear auth data from login and go to authenticate | ||
initialRequestFailed = true | ||
clearAuthData() | ||
return routeFunction(config.AUTHENTICATE) | ||
}) | ||
} else if (initialRequestFailed && authData) { | ||
console.error('You have manual authData management but haven\'t cleared it manually after failed initialRequest') | ||
} | ||
@@ -88,2 +92,3 @@ } | ||
function loginWrap (...args) { | ||
initialRequestFailed = false // reset this one | ||
return apiService.login.apply(apiService, args) | ||
@@ -90,0 +95,0 @@ .then((res) => { |
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
206242
5259