diff --git a/packages/api/src/authoring-api.js b/packages/api/src/authoring-api.js index 4dfb9522..d524097f 100644 --- a/packages/api/src/authoring-api.js +++ b/packages/api/src/authoring-api.js @@ -12,31 +12,27 @@ export class AuthoringAPI extends BaseAPI { list_question_presets() { return this.get_presets({ - type: "question", - action: "list", + action: "list_question_presets", }); } list_template_presets() { return this.get_presets({ - type: "template", - action: "list", + action: "list_template_presets", }); } get_question_preset(name) { return this.get_presets({ - type: "question", - action: "get", - name: name, + action: "get_question_preset", + preset_name: name, }); } get_template_preset(name) { return this.get_presets({ - type: "template", - action: "get", - name: name, + action: "get_template_preset", + preset_name: name, }); } } diff --git a/packages/authoring-menubar/src/task-menubar.js b/packages/authoring-menubar/src/task-menubar.js index 970f16a4..808c1f0b 100644 --- a/packages/authoring-menubar/src/task-menubar.js +++ b/packages/authoring-menubar/src/task-menubar.js @@ -23,7 +23,8 @@ export class TaskMenubar extends Menubar { } insert_question_preset(name) { - this.api.get_question_preset(name).then((cells) => { + this.api.get_question_preset(name).then((res) => { + const cells = res.data; insert_question_preset_dialog(name, (task_name, points) => { set_task_ids(cells, task_name, points); insert_cells(cells); @@ -33,7 +34,7 @@ export class TaskMenubar extends Menubar { activate() { this.api.list_question_presets().then((presets) => { - this.presets = presets; + this.presets = presets.data; this.add_save_button(); this.add_divider(); this.add_question_menu(); diff --git a/packages/authoring-menubar/src/template-menubar.js b/packages/authoring-menubar/src/template-menubar.js index f9cee70e..d29c032e 100644 --- a/packages/authoring-menubar/src/template-menubar.js +++ b/packages/authoring-menubar/src/template-menubar.js @@ -24,7 +24,8 @@ export class TemplateMenubar extends Menubar { } insert_template_preset(name) { - this.api.get_template_preset(name).then((cells) => { + this.api.get_template_preset(name).then((res) => { + const cells = res.data; set_template_ids(cells, utils.randomString(8)); insert_cells(cells); }); @@ -32,7 +33,7 @@ export class TemplateMenubar extends Menubar { activate() { this.api.list_template_presets().then((presets) => { - this.presets = presets; + this.presets = presets.data; this.add_save_button(); this.add_divider(); this.add_template_menu();