Redirect to root from '/donate' if the plugin is disabled

This commit is contained in:
Angus McLeod 2018-07-02 10:30:38 +10:00
parent 4e9cc7d187
commit d686ece85b
1 changed files with 10 additions and 2 deletions

View File

@ -1,8 +1,16 @@
import DiscourseRoute from "discourse/routes/discourse";
import DiscourseURL from 'discourse/lib/url';
import { popupAjaxError } from 'discourse/lib/ajax-error';
import { ajax } from 'discourse/lib/ajax';
export default DiscourseRoute.extend({
redirect() {
if (!Discourse.SiteSettings.discourse_donations_enabled) {
DiscourseURL.routeTo('/');
return;
}
},
setupController(controller) {
let charges = [];
let subscriptions = [];
@ -24,6 +32,6 @@ export default DiscourseRoute.extend({
});
}).catch(popupAjaxError).finally(() => {
controller.set('loadingDonations', false);
})
});
}
});