quiq-chat
Advanced tools
Comparing version 1.8.90 to 1.8.91
@@ -143,2 +143,3 @@ 'use strict'; | ||
var noOfErrors = 0; | ||
var stubbornFetch = (function (url, fetchRequest) { | ||
@@ -173,3 +174,12 @@ var retryCount = 0; | ||
} | ||
if (noOfErrors > 100) { | ||
window.clearTimeout(timerId); | ||
burnItDown(); | ||
if (callbacks.onBurn) { | ||
callbacks.onBurn(); | ||
} | ||
return reject(); | ||
} | ||
delayIfNeeded().then(function () { | ||
@@ -189,2 +199,12 @@ return fetch(url, fetchRequest).then(function (response) { | ||
if (response.status === 401) { | ||
if (url === getSessionApiUrl()) { | ||
window.clearTimeout(timerId); | ||
burnItDown(); | ||
if (callbacks.onBurn) { | ||
callbacks.onBurn(); | ||
} | ||
return reject(response); | ||
} | ||
if (url.includes('/session/web/generate') && fetchRequest.method && fetchRequest.method.toUpperCase() === 'POST') { | ||
@@ -202,2 +222,3 @@ if (callbacks.onError) { | ||
noOfErrors++; | ||
return login().then(validateSession).then(request); | ||
@@ -213,2 +234,3 @@ } | ||
retryCount++; | ||
noOfErrors++; | ||
return request(); | ||
@@ -239,2 +261,3 @@ } | ||
retryCount++; | ||
noOfErrors++; | ||
return request(); | ||
@@ -258,3 +281,3 @@ } | ||
var version = "1.8.90"; | ||
var version = "1.8.91"; | ||
@@ -261,0 +284,0 @@ // |
{ | ||
"name": "quiq-chat", | ||
"version": "1.8.90", | ||
"version": "1.8.91", | ||
"description": "Library to help with network requests to create a webchat client for Quiq Messaging", | ||
@@ -5,0 +5,0 @@ "main": "build/quiq-chat.js", |
@@ -6,3 +6,3 @@ // @flow | ||
import {burnItDown} from './utils'; | ||
import {getBurned} from './globals'; | ||
import {getBurned, getSessionApiUrl} from './globals'; | ||
import type {ApiError, IsomorphicFetchNetworkError} from 'types'; | ||
@@ -28,2 +28,3 @@ | ||
let noOfErrors = 0; | ||
export default (url: string, fetchRequest: RequestOptions) => { | ||
@@ -55,3 +56,12 @@ let retryCount = 0; | ||
} | ||
if (noOfErrors > 100) { | ||
window.clearTimeout(timerId); | ||
burnItDown(); | ||
if (callbacks.onBurn) { | ||
callbacks.onBurn(); | ||
} | ||
return reject(); | ||
} | ||
delayIfNeeded().then(() => | ||
@@ -72,2 +82,12 @@ fetch(url, fetchRequest).then( | ||
if (response.status === 401) { | ||
if (url === getSessionApiUrl()) { | ||
window.clearTimeout(timerId); | ||
burnItDown(); | ||
if (callbacks.onBurn) { | ||
callbacks.onBurn(); | ||
} | ||
return reject(response); | ||
} | ||
if ( | ||
@@ -89,2 +109,3 @@ url.includes('/session/web/generate') && | ||
noOfErrors++; | ||
return login().then(validateSession).then(request); | ||
@@ -100,2 +121,3 @@ } | ||
retryCount++; | ||
noOfErrors++; | ||
return request(); | ||
@@ -127,2 +149,3 @@ } | ||
retryCount++; | ||
noOfErrors++; | ||
return request(); | ||
@@ -129,0 +152,0 @@ } |
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
863015
8566