basic impl of players list and loot api in frontend
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user