diff options
author | Phil Hughes <me@iamphill.com> | 2016-08-04 18:16:50 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-08-17 19:12:47 +0300 |
commit | 3e839b3468bd4280d96ce5cec4eab27d16abc85d (patch) | |
tree | 553383f4babb653bbdc746c0ee2dd034fdaa4c7e /app/assets/javascripts/boards/services | |
parent | 9172c45bdbda91a71a3078dd8fe18b17a38eed1f (diff) |
Hooked the frontend services up with the backend
Diffstat (limited to 'app/assets/javascripts/boards/services')
-rw-r--r-- | app/assets/javascripts/boards/services/board_service.js.es6 | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/app/assets/javascripts/boards/services/board_service.js.es6 b/app/assets/javascripts/boards/services/board_service.js.es6 index 859fd961230..398e3c5650d 100644 --- a/app/assets/javascripts/boards/services/board_service.js.es6 +++ b/app/assets/javascripts/boards/services/board_service.js.es6 @@ -2,12 +2,8 @@ class BoardService { constructor (root) { Vue.http.options.root = root; - this.resource = Vue.resource(`${root}{/id}`, {}, { - all: { - method: 'GET', - url: 'all' - } - }); + this.lists = Vue.resource(`${root}{/id}.json`, {}); + this.list = Vue.resource(`${root}/lists{/id}.json`, {}); } setCSRF () { @@ -16,11 +12,32 @@ class BoardService { all () { this.setCSRF(); - return this.resource.all(); + return this.lists.get(); + } + + createList (labelId) { + this.setCSRF(); + + return this.list.save({}, { + list: { + label_id: labelId + } + }); } - updateBoard (id, index) { + updateList (list) { this.setCSRF(); - return this.resource.update({ id: id }, { index: index }); + + return this.list.update({ id: list.id }, { + list: { + position: list.position + } + }); + } + + destroyList (id) { + this.setCSRF(); + + return this.list.delete({ id }); } }; |