more refactoring, removing imports

This commit is contained in:
2019-07-31 21:48:59 +02:00
parent dae7633c11
commit 15d87e3b47
5 changed files with 74 additions and 73 deletions

View File

@@ -1,9 +1,10 @@
import { AppStorage } from '../AppStorage'
import { Api, AppStorage } from '../AppStorage'
export default {
props: ["id"],
data () { return {
notifications: [],
loot: [],
}},
methods: {
updateWealth (value) {
@@ -20,6 +21,20 @@ export default {
.then(_ => { if (AppStorage.debug) this.notifications.push("Claim withdrawn")})
},
parseLoot (items) {
this.loot = [];
items.map(item => {
this.loot.push(item);
});
}
},
watch: {
id: {
immediate: true,
handler: function(newId) {
Api.fetchLoot(newId).then(this.parseLoot);
}
},
},
computed: {
player () {
@@ -29,14 +44,14 @@ export default {
cp: '-', sp: '-', gp: '-', pp: '-',
debt: 0 };
} else {
console.log("Update player");
return AppStorage.state.player_list[this.id];
}
}
},
},
render () {
return this.$scopedSlots.default({
player: this.player,
loot: this.loot,
notifications: this.notifications,
actions: {
updateWealth: this.updateWealth,