mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
store & retrieve settings
This commit is contained in:
parent
0761da85e7
commit
e7bbf0c9bc
@ -55,6 +55,14 @@
|
||||
update: function(id, data) {
|
||||
return api('put', '/api/items/' + id, data)
|
||||
}
|
||||
}
|
||||
},
|
||||
settings: {
|
||||
get: function() {
|
||||
return api('get', '/api/settings').then(json)
|
||||
},
|
||||
update: function(data) {
|
||||
return api('put', '/api/settings', data)
|
||||
},
|
||||
},
|
||||
}
|
||||
})()
|
||||
|
@ -4,6 +4,12 @@ var vm = new Vue({
|
||||
el: '#app',
|
||||
created: function() {
|
||||
this.refresh()
|
||||
var vm = this
|
||||
api.settings.get().then(function(data) {
|
||||
console.log(1)
|
||||
vm.filterSelected = data.filter
|
||||
console.log(1)
|
||||
})
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
@ -42,6 +48,11 @@ var vm = new Vue({
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'filterSelected': function(newVal) {
|
||||
api.settings.update({filter: newVal}).then(function() {
|
||||
this.$emit('refresh:items')
|
||||
}.bind(this))
|
||||
},
|
||||
'feedSelected': function(newVal, oldVal) {
|
||||
var promise = null
|
||||
if (newVal === null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user