fixes api
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<PlayerView
|
<PlayerView
|
||||||
:id="player_id"
|
:id="player_id"
|
||||||
|
:players="playersId"
|
||||||
v-slot="{ player, loot, notifications, actions, claims }"
|
v-slot="{ player, loot, notifications, actions, claims }"
|
||||||
>
|
>
|
||||||
<main id="app" class="container">
|
<main id="app" class="container">
|
||||||
@@ -142,7 +143,7 @@ export default {
|
|||||||
api.fetch("items", "GET", null),
|
api.fetch("items", "GET", null),
|
||||||
])
|
])
|
||||||
.then(([players, loot, items]) => {
|
.then(([players, loot, items]) => {
|
||||||
this.playerList = players.value;
|
this.$set(this, 'playerList', players.value);
|
||||||
this.groupLoot = loot.value;
|
this.groupLoot = loot.value;
|
||||||
this.itemsInventory = items.value;
|
this.itemsInventory = items.value;
|
||||||
})
|
})
|
||||||
@@ -177,6 +178,7 @@ export default {
|
|||||||
showPlayerChest () { return this.activeView == 'player' },
|
showPlayerChest () { return this.activeView == 'player' },
|
||||||
isAdding () { return this.activeView == 'adding' },
|
isAdding () { return this.activeView == 'adding' },
|
||||||
playerIsGroup () { return this.player_id == 0 },
|
playerIsGroup () { return this.player_id == 0 },
|
||||||
|
playersId () { return this.playerList.map(p => p.id).filter(i => i != 0); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { api } from '../lootalot.js'
|
import { api } from '../lootalot.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ["id"],
|
props: ["id", "players"],
|
||||||
data () { return {
|
data () { return {
|
||||||
player: {
|
player: {
|
||||||
name: "Loading",
|
name: "Loading",
|
||||||
@@ -76,7 +76,15 @@ export default {
|
|||||||
putClaim (itemId) { this.call("claims", "PUT", itemId) },
|
putClaim (itemId) { this.call("claims", "PUT", itemId) },
|
||||||
withdrawClaim (itemId) { this.call("claims", "DELETE", itemId) },
|
withdrawClaim (itemId) { this.call("claims", "DELETE", itemId) },
|
||||||
buyItems(items) { this.call("loot", "PUT", items) },
|
buyItems(items) { this.call("loot", "PUT", items) },
|
||||||
sellItems (items) { this.call("loot", "DELETE", { items, global_mod: null, players: null }) },
|
sellItems (items) {
|
||||||
|
let players;
|
||||||
|
if (this.player.id == 0) {
|
||||||
|
players = this.players;
|
||||||
|
} else {
|
||||||
|
players = null;
|
||||||
|
}
|
||||||
|
this.call("loot", "DELETE", { items, global_mod: null, players })
|
||||||
|
},
|
||||||
undoLastAction () { this.call("events/last", "DELETE", null) },
|
undoLastAction () { this.call("events/last", "DELETE", null) },
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
Reference in New Issue
Block a user