diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2018-01-29 12:32:22 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2018-01-29 12:32:22 +0000 |
commit | 3c0aa44fa9125ce7c360f64994e483cc9e7cb951 (patch) | |
tree | 1fe543204e5fd942394817d165cf09e5d4a253c7 | |
parent | a5a91d7ed61fff41f62d2d0be84ddb8241366256 (diff) | |
download | gitlab-ce-3c0aa44fa9125ce7c360f64994e483cc9e7cb951.tar.gz |
Replace $.post in awards handler with axios
-rw-r--r-- | app/assets/javascripts/awards_handler.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index 622764107ad..d9341837149 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -1,8 +1,10 @@ /* eslint-disable class-methods-use-this */ import _ from 'underscore'; import Cookies from 'js-cookie'; +import { s__ } from './locale'; import { isInIssuePage, updateTooltipTitle } from './lib/utils/common_utils'; -import Flash from './flash'; +import flash from './flash'; +import axios from './lib/utils/axios_utils'; const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd'; const transitionEndEventString = 'transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'; @@ -441,13 +443,15 @@ class AwardsHandler { if (this.isUserAuthored($emojiButton)) { this.userAuthored($emojiButton); } else { - $.post(awardUrl, { + axios.post(awardUrl, { name: emoji, - }, (data) => { + }) + .then(({ data }) => { if (data.ok) { callback(); } - }).fail(() => new Flash('Something went wrong on our end.')); + }) + .catch(() => flash(s__('Something went wrong on our end.'))); } } |