summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/issuable_index.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-01-29 12:23:21 +0000
committerPhil Hughes <me@iamphill.com>2018-01-29 12:23:21 +0000
commitba96309fb895bf590adec66f6445b3f34da3310b (patch)
treec61f6eb81340279a8fb604a709ad15d65cc09361 /app/assets/javascripts/issuable_index.js
parentdab430f0316e997657d75b1478394bfc71c6a2bd (diff)
downloadgitlab-ce-ba96309fb895bf590adec66f6445b3f34da3310b.tar.gz
Converted issuable_index to axios
Diffstat (limited to 'app/assets/javascripts/issuable_index.js')
-rw-r--r--app/assets/javascripts/issuable_index.js28
1 files changed, 15 insertions, 13 deletions
diff --git a/app/assets/javascripts/issuable_index.js b/app/assets/javascripts/issuable_index.js
index c3e0acdff66..aafadcb7d4e 100644
--- a/app/assets/javascripts/issuable_index.js
+++ b/app/assets/javascripts/issuable_index.js
@@ -1,3 +1,6 @@
+import axios from './lib/utils/axios_utils';
+import flash from './flash';
+import { __ } from './locale';
import IssuableBulkUpdateSidebar from './issuable_bulk_update_sidebar';
import IssuableBulkUpdateActions from './issuable_bulk_update_actions';
@@ -23,20 +26,19 @@ export default class IssuableIndex {
$('.incoming-email-token-reset').on('click', (e) => {
e.preventDefault();
- $.ajax({
- type: 'PUT',
- url: $('.incoming-email-token-reset').attr('href'),
- dataType: 'json',
- success(response) {
- $('#issuable_email').val(response.new_address).focus();
- },
- beforeSend() {
- $('.incoming-email-token-reset').text('resetting...');
- },
- complete() {
+ $('.incoming-email-token-reset').text('resetting...');
+
+ axios.put($('.incoming-email-token-reset').attr('href'))
+ .then(({ data }) => {
+ $('#issuable_email').val(data.new_address).focus();
+
$('.incoming-email-token-reset').text('reset it');
- },
- });
+ })
+ .catch(() => {
+ flash(__('There was an error when reseting email token.'));
+
+ $('.incoming-email-token-reset').text('reset it');
+ });
});
}
}