1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-25 02:36:28 +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 {
matchedErrorClass = testErrorAgainstAll({ type, reason, xhr });
// If none found, show the next error message
if (!matchedErrorClass) {
// If none found, check the internet connection
// 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');
}
}

View File

@ -121,6 +121,9 @@ const ErrorClasses = {
},
'contactUs': {
'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': {