moves logic to PlayerView, adds simple notifications when debugging
This commit is contained in:
@@ -2,13 +2,24 @@ import { AppStorage } from '../AppStorage'
|
||||
|
||||
export default {
|
||||
props: ["id"],
|
||||
data () { return {}},
|
||||
data () { return {
|
||||
notifications: [],
|
||||
}},
|
||||
methods: {
|
||||
updateWealth (value) {
|
||||
AppStorage.updatePlayerWealth(value)
|
||||
.then(_ => {if (AppStorage.debug) console.log("Wealth updated")})
|
||||
.then(_ => {if (AppStorage.debug) this.notifications.push("Wealth updated")})
|
||||
.catch(e => {if (AppStorage.debug) console.error("wealthUpdate Error", e)})
|
||||
}
|
||||
},
|
||||
putClaim (itemId) {
|
||||
AppStorage.putRequest(itemId)
|
||||
.then(_ => { if (AppStorage.debug) this.notifications.push("Claim put")})
|
||||
},
|
||||
withdrawClaim (itemId) {
|
||||
AppStorage.cancelRequest(itemId)
|
||||
.then(_ => { if (AppStorage.debug) this.notifications.push("Claim withdrawn")})
|
||||
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
player () {
|
||||
@@ -26,7 +37,12 @@ export default {
|
||||
render () {
|
||||
return this.$scopedSlots.default({
|
||||
player: this.player,
|
||||
updateWealth: this.updateWealth,
|
||||
notifications: this.notifications,
|
||||
actions: {
|
||||
updateWealth: this.updateWealth,
|
||||
putClaim: this.putClaim,
|
||||
withdrawClaim: this.withdrawClaim,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user