diff --git a/app/controllers/custom_wizard/admin/subscription.rb b/app/controllers/custom_wizard/admin/subscription.rb new file mode 100644 index 00000000..ae0d8f08 --- /dev/null +++ b/app/controllers/custom_wizard/admin/subscription.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true +class CustomWizard::SubscriptionController < ::Admin::AdminController + before_action :ensure_admin + + def index + subcription = CustomWizard::Subscription.new + render_json_dump( + subscribed: subcription.subscribed?, + subscription_type: subcription.type, + subscription_attributes: CustomWizard::Subscription.attributes, + ) + end +end \ No newline at end of file diff --git a/assets/javascripts/discourse/services/subscription.js b/assets/javascripts/discourse/services/subscription.js index 3d2cad2b..a3cce291 100644 --- a/assets/javascripts/discourse/services/subscription.js +++ b/assets/javascripts/discourse/services/subscription.js @@ -27,7 +27,7 @@ export default class SubscriptionService extends Service { } retrieveSubscriptionStatus() { - ajax("/admin/wizards").then(result => { + ajax("/admin/subscription").then(result => { console.log(result) this.subscribed = result.subscribed; this.subscriptionType = result.subscription_type; diff --git a/config/routes.rb b/config/routes.rb index 607a87ac..8f865fec 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,6 +14,7 @@ Discourse::Application.routes.append do scope module: 'custom_wizard', constraints: AdminConstraint.new do get 'admin/wizards' => 'admin#index' + get 'admin/subscription' => 'subscription#index' get 'admin/wizards/wizard' => 'admin_wizard#index' get 'admin/wizards/wizard/create' => 'admin#index'