From 03048e5881fb474666e828003fa0b0e791879813 Mon Sep 17 00:00:00 2001 From: Pedro Carmo Date: Tue, 15 Dec 2020 15:56:38 +0000 Subject: [PATCH 1/2] fix for phonegap usage --- src/httpVueLoader.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/httpVueLoader.js b/src/httpVueLoader.js index 9bb2d9f..bedc41a 100644 --- a/src/httpVueLoader.js +++ b/src/httpVueLoader.js @@ -448,11 +448,16 @@ xhr.onreadystatechange = function() { if ( xhr.readyState === 4 ) { - - if ( xhr.status >= 200 && xhr.status < 300 ) + + if ( (xhr.status >= 200 && xhr.status < 300)) resolve(xhr.responseText); - else - reject(xhr.status); + else { + // fix for phonegap status + if(cordova !== 'undefined' && xhr.status === 0 && xhr.responseText !== '') + resolve(xhr.responseText) + else + reject(xhr.status); + } } }; From 3427ef42f059f193bd53b1b7b7abd8ed19d63459 Mon Sep 17 00:00:00 2001 From: Pedro Carmo Date: Tue, 15 Dec 2020 16:03:49 +0000 Subject: [PATCH 2/2] Update httpVueLoader.js add try case --- src/httpVueLoader.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/httpVueLoader.js b/src/httpVueLoader.js index bedc41a..3b9565c 100644 --- a/src/httpVueLoader.js +++ b/src/httpVueLoader.js @@ -452,11 +452,15 @@ if ( (xhr.status >= 200 && xhr.status < 300)) resolve(xhr.responseText); else { - // fix for phonegap status - if(cordova !== 'undefined' && xhr.status === 0 && xhr.responseText !== '') - resolve(xhr.responseText) - else - reject(xhr.status); + try{ + // fix for phonegap status + if(cordova !== 'undefined' && xhr.status === 0 && xhr.responseText !== '') + resolve(xhr.responseText) + else + reject(xhr.status); + } catch (e){ + reject(xhr.status); + } } } };