basic impl of players list and loot api in frontend

This commit is contained in:
2019-07-03 16:07:56 +02:00
parent b8968aebbd
commit 4e28eb4159
4 changed files with 46 additions and 29 deletions

View File

@@ -118,17 +118,22 @@
data () {
return {
app_state: AppStorage.state,
content: [
{id: 10, name: "Épée longue +2 acérée",
sell_value: 15000 },
{id: 5, name: "Ceinture de force +6",
sell_value: 80000 },
],
content: [],
is_selling: false,
is_adding: false,
sell_selected: [],
};
},
methods: {
fetchLoot () {
fetch(`http://localhost:8088/loot/${this.player}`)
.then(r => r.json())
.then(data => {
data.forEach(item => this.content.push(item));
})
.then(_ => console.log("Loot loaded !"))
}
},
computed: {
// Can the active user sell items from this chest ?
canSell () {
@@ -158,6 +163,9 @@
&& !this.is_adding);
}
},
mounted () {
this.fetchLoot();
}
}
</script>