mirror of
https://github.com/nkanaev/yarr.git
synced 2025-09-13 18:00:05 +00:00
list all/folder/feed items
This commit is contained in:
@@ -44,8 +44,14 @@
|
||||
delete: function(id) {
|
||||
return api('delete', '/api/folders/' + id)
|
||||
},
|
||||
list_items: function(id) {
|
||||
return api('get', '/api/folders/' + id + '/items').then(json)
|
||||
}
|
||||
},
|
||||
items: {
|
||||
list: function() {
|
||||
return api('get', '/api/items').then(json)
|
||||
},
|
||||
update: function(id, data) {
|
||||
return api('put', '/api/items/' + id, data)
|
||||
}
|
||||
|
@@ -42,16 +42,22 @@ var vm = new Vue({
|
||||
},
|
||||
watch: {
|
||||
'feedSelected': function(newVal, oldVal) {
|
||||
if (newVal === null) return
|
||||
var vm = this
|
||||
var parts = newVal.split(':', 2)
|
||||
var type = parts[0]
|
||||
var guid = parts[1]
|
||||
if (type === 'feed') {
|
||||
api.feeds.list_items(guid).then(function(items) {
|
||||
vm.items = items
|
||||
})
|
||||
var promise = null
|
||||
if (newVal === null) {
|
||||
promise = api.items.list()
|
||||
} else {
|
||||
var parts = newVal.split(':', 2)
|
||||
var type = parts[0]
|
||||
var guid = parts[1]
|
||||
if (type === 'feed') {
|
||||
promise = api.feeds.list_items(guid)
|
||||
} else if (type == 'folder') {
|
||||
promise = api.folders.list_items(guid)
|
||||
}
|
||||
}
|
||||
promise.then(function(items) {
|
||||
vm.items = items
|
||||
})
|
||||
},
|
||||
'itemSelected': function(newVal, oldVal) {
|
||||
this.itemSelectedDetails = this.itemsById[newVal]
|
||||
|
Reference in New Issue
Block a user