summaryrefslogtreecommitdiffstats
path: root/core/src/OC/xhr-error.js
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-09-25 18:19:42 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-10-01 17:16:09 +0200
commitb9bc2417e7a8dc81feb0abe20359bedaf864f790 (patch)
tree61b47fbf37c1d168da8625224debde9e6a985348 /core/src/OC/xhr-error.js
parent7fb651235128dcbca8a6683b5cdafdf835f46300 (diff)
downloadnextcloud-server-b9bc2417e7a8dc81feb0abe20359bedaf864f790.tar.gz
nextcloud-server-b9bc2417e7a8dc81feb0abe20359bedaf864f790.zip
Comply to eslint
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/src/OC/xhr-error.js')
-rw-r--r--core/src/OC/xhr-error.js29
1 files changed, 15 insertions, 14 deletions
diff --git a/core/src/OC/xhr-error.js b/core/src/OC/xhr-error.js
index 43b2eba7229..8d2ad115336 100644
--- a/core/src/OC/xhr-error.js
+++ b/core/src/OC/xhr-error.js
@@ -1,4 +1,4 @@
-/*
+/**
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
@@ -34,11 +34,12 @@ import Notification from './notification'
*/
export const ajaxConnectionLostHandler = _.throttle(() => {
Notification.showTemporary(t('core', 'Connection to server lost'))
-}, 7 * 1000, {trailing: false})
+}, 7 * 1000, { trailing: false })
/**
* Process ajax error, redirects to main page
* if an error/auth error status was returned.
+ * @param {XMLHttpRequest} xhr xhr request
*/
export const processAjaxError = xhr => {
// purposefully aborted request ?
@@ -50,18 +51,18 @@ export const processAjaxError = xhr => {
if (_.contains([302, 303, 307, 401], xhr.status) && OC.currentUser) {
// sometimes "beforeunload" happens later, so need to defer the reload a bit
- setTimeout(function () {
+ setTimeout(function() {
if (!OC._userIsNavigatingAway && !OC._reloadCalled) {
let timer = 0
const seconds = 5
- const interval = setInterval(function () {
- Notification.showUpdate(n('core', 'Problem loading page, reloading in %n second', 'Problem loading page, reloading in %n seconds', seconds - timer))
- if (timer >= seconds) {
- clearInterval(interval)
- OC.reload()
- }
- timer++
- }, 1000 // 1 second interval
+ const interval = setInterval(function() {
+ Notification.showUpdate(n('core', 'Problem loading page, reloading in %n second', 'Problem loading page, reloading in %n seconds', seconds - timer))
+ if (timer >= seconds) {
+ clearInterval(interval)
+ OC.reload()
+ }
+ timer++
+ }, 1000 // 1 second interval
)
// only call reload once
@@ -70,7 +71,7 @@ export const processAjaxError = xhr => {
}, 100)
} else if (xhr.status === 0) {
// Connection lost (e.g. WiFi disconnected or server is down)
- setTimeout(function () {
+ setTimeout(function() {
if (!OC._userIsNavigatingAway && !OC._reloadCalled) {
// TODO: call method above directly
OC._ajaxConnectionLostHandler()
@@ -85,7 +86,7 @@ export const processAjaxError = xhr => {
* This means that if this XHR object returns 401 or session timeout errors,
* the current page will automatically be reloaded.
*
- * @param {XMLHttpRequest} xhr
+ * @param {XMLHttpRequest} xhr xhr request
*/
export const registerXHRForErrorProcessing = xhr => {
const loadCallback = () => {
@@ -93,7 +94,7 @@ export const registerXHRForErrorProcessing = xhr => {
return
}
- if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
+ if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) {
return
}