mirror of
https://github.com/ascribe/onion.git
synced 2024-12-31 09:07:48 +01:00
Add simple check for determining if user's offline while uploading
This commit is contained in:
parent
4212b776ee
commit
e7cf9a44a0
@ -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');
|
||||
}
|
||||
}
|
||||
|
@ -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': {
|
||||
|
Loading…
Reference in New Issue
Block a user