1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 16:48:04 +02:00

Add simple check for determining if user's offline while uploading

This commit is contained in:
Brett Sun 2015-12-09 15:57:01 +01:00
parent 4212b776ee
commit e7cf9a44a0
2 changed files with 9 additions and 2 deletions

View File

@ -479,8 +479,12 @@ const ReactS3FineUploader = React.createClass({
} else { } else {
matchedErrorClass = testErrorAgainstAll({ type, reason, xhr }); matchedErrorClass = testErrorAgainstAll({ type, reason, xhr });
// If none found, show the next error message // If none found, check the internet connection
if (!matchedErrorClass) { // TODO: use a better mechanism for checking network state, ie. offline.js
if ('onLine' in window.navigator && !window.navigator.onLine) {
matchedErrorClass = ErrorClasses.upload.offline;
} else {
// Otherwise, show the next error message in the queue
matchedErrorClass = ErrorQueueStore.getNextError('upload'); matchedErrorClass = ErrorQueueStore.getNextError('upload');
} }
} }

View File

@ -121,6 +121,9 @@ const ErrorClasses = {
}, },
'contactUs': { 'contactUs': {
'prettifiedText': getLangText("We're having a really hard time with your upload. Please contact us for more help.") 'prettifiedText': getLangText("We're having a really hard time with your upload. Please contact us for more help.")
},
'offline': {
'prettifiedText': getLangText('It looks like your Internet connection might have gone down during the upload. Please check your connection and try again.')
} }
}, },
'default': { 'default': {