diff options
author | Phil Hughes <me@iamphill.com> | 2018-02-02 13:38:31 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-02-05 12:40:57 +0300 |
commit | 85e0bf39ced8659385aea9bbee94a9d21c5f6a70 (patch) | |
tree | 774ad651ccb6a4bcc82938d0a846c4d0c0fc229c /app | |
parent | 9f5537304bf30bbe7430cc0290df3acea035a428 (diff) |
Converted project_label_subscription.js to use axios
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/project_label_subscription.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/assets/javascripts/project_label_subscription.js b/app/assets/javascripts/project_label_subscription.js index b65521b278f..64b7dd540f9 100644 --- a/app/assets/javascripts/project_label_subscription.js +++ b/app/assets/javascripts/project_label_subscription.js @@ -1,3 +1,7 @@ +import { __ } from './locale'; +import axios from './lib/utils/axios_utils'; +import flash from './flash'; + export default class ProjectLabelSubscription { constructor(container) { this.$container = $(container); @@ -17,10 +21,7 @@ export default class ProjectLabelSubscription { $btn.addClass('disabled'); $span.toggleClass('hidden'); - $.ajax({ - type: 'POST', - url, - }).done(() => { + axios.post(url).then(() => { let newStatus; let newAction; @@ -45,6 +46,6 @@ export default class ProjectLabelSubscription { return button; }); - }); + }).catch(() => flash(__('There was an error subscribing to this label.'))); } } |