diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-25 03:06:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-25 03:06:12 +0300 |
commit | 504ab1e32cbd3a529fe61f6c9a30823febce796c (patch) | |
tree | 3f5b7548465cf85bc41b13d36fbd008a271f23e7 /app | |
parent | 150effab274651b3a8d2041e64ced734d1f3a349 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/lib/utils/axios_utils.js | 15 | ||||
-rw-r--r-- | app/assets/javascripts/lib/utils/suppress_ajax_errors_during_navigation.js | 16 |
2 files changed, 0 insertions, 31 deletions
diff --git a/app/assets/javascripts/lib/utils/axios_utils.js b/app/assets/javascripts/lib/utils/axios_utils.js index a04fe609015..c17f62c671c 100644 --- a/app/assets/javascripts/lib/utils/axios_utils.js +++ b/app/assets/javascripts/lib/utils/axios_utils.js @@ -1,6 +1,5 @@ import axios from 'axios'; import csrf from './csrf'; -import suppressAjaxErrorsDuringNavigation from './suppress_ajax_errors_during_navigation'; axios.defaults.headers.common[csrf.headerKey] = csrf.token; // Used by Rails to check if it is a valid XHR request @@ -26,20 +25,6 @@ axios.interceptors.response.use( }, ); -let isUserNavigating = false; -window.addEventListener('beforeunload', () => { - isUserNavigating = true; -}); - -// Ignore AJAX errors caused by requests -// being cancelled due to browser navigation -const { gon } = window; -const featureFlagEnabled = gon && gon.features && gon.features.suppressAjaxNavigationErrors; -axios.interceptors.response.use( - response => response, - err => suppressAjaxErrorsDuringNavigation(err, isUserNavigating, featureFlagEnabled), -); - export default axios; /** diff --git a/app/assets/javascripts/lib/utils/suppress_ajax_errors_during_navigation.js b/app/assets/javascripts/lib/utils/suppress_ajax_errors_during_navigation.js deleted file mode 100644 index 4c61da9b862..00000000000 --- a/app/assets/javascripts/lib/utils/suppress_ajax_errors_during_navigation.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * An Axios error interceptor that suppresses AJAX errors caused - * by the request being cancelled when the user navigates to a new page - */ -export default (err, isUserNavigating, featureFlagEnabled) => { - if (featureFlagEnabled && isUserNavigating && err.code === 'ECONNABORTED') { - // If the user is navigating away from the current page, - // prevent .then() and .catch() handlers from being - // called by returning a Promise that never resolves - return new Promise(() => {}); - } - - // The error is not related to browser navigation, - // so propagate the error - return Promise.reject(err); -}; |