From 50d21925cfd25a8ba275e0912abc704b7c8cb575 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 24 Aug 2015 15:16:32 +0800 Subject: [PATCH] Use popupAjaxError. --- .../extend-for-solved-button.js.es6 | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 b/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 index 7cedd83..ab04fcb 100644 --- a/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 +++ b/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 @@ -5,6 +5,7 @@ import Topic from 'discourse/models/topic'; import User from 'discourse/models/user'; import TopicStatus from 'discourse/views/topic-status'; import computed from 'ember-addons/ember-computed-decorators'; +import { popupAjaxError } from 'discourse/lib/ajax-error'; export default { name: 'extend-for-solved-button', @@ -113,17 +114,7 @@ export default { data: { id: this.get('post.id') } - }).then(function(){ - // - }).catch(function(error){ - var message = I18n.t("generic_error"); - try { - message = $.parseJSON(error.responseText).errors; - } catch (e) { - // nothing we can do - } - bootbox.alert(message); - }); + }).catch(popupAjaxError); }, clearAcceptedAnswer: function(){ @@ -155,17 +146,7 @@ export default { data: { id: this.get('post.id') } - }).then(function(){ - // - }).catch(function(error){ - var message = I18n.t("generic_error"); - try { - message = $.parseJSON(error.responseText).errors; - } catch (e) { - // nothing we can do - } - bootbox.alert(message); - }); + }).catch(popupAjaxError); } }); }