Commit 4d1bc2c3 authored by Bryce Johnson's avatar Bryce Johnson

Fixup widget and approvals store.

parent 735067df
...@@ -23,21 +23,20 @@ ...@@ -23,21 +23,20 @@
fetch() { fetch() {
return this.api.fetchApprovals() return this.api.fetchApprovals()
.then((res) => this.assignToRootStore(res.data)); .then(res => this.assignToRootStore(res.data));
} }
approve() { approve() {
return this.api.approveMergeRequest() return this.api.approveMergeRequest()
.then((data) => this.rootStore.assignToData(data)); .then(res => this.rootStore.assignToData(res.data));
} }
unapprove() { unapprove() {
return this.api.unapproveMergeRequest() return this.api.unapproveMergeRequest()
.then((data) => this.rootStore.assignToData(data)); .then(res => this.rootStore.assignToData(res.data));
} }
} }
gl.ApprovalsStore = ApprovalsStore; gl.ApprovalsStore = ApprovalsStore;
})(); })();
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
$(() => { $(() => {
const rootEl = document.getElementById('merge-request-widget-app'); const rootEl = document.getElementById('merge-request-widget-app');
const widgetSharedStore = new gl.MergeRequestWidgetStore(rootEl); // TODO: encapsulate better const widgetSharedStore = new gl.MergeRequestWidgetStore(rootEl);
gl.MergeRequestWidgetApp = new Vue({ gl.MergeRequestWidgetApp = new Vue({
el: rootEl, el: rootEl,
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
} }
initApprovals() { initApprovals() {
const approvalsStore = new gl.ApprovalsStore(this); gl.ApprovalsStore = new gl.ApprovalsStore(this);
this.assignToData('approvals', approvalsStore.data); this.assignToData('approvals', this.dataset.approvals);
} }
assignToData(key, val) { assignToData(key, val) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment