fixes API consumer
This commit is contained in:
@@ -34,23 +34,23 @@ export const Api = {
|
|||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
},
|
},
|
||||||
putClaim (player_id, item_id) {
|
putClaim (player_id, item_id) {
|
||||||
const payload = { player_id, item_id };
|
const payload = item_id;
|
||||||
return this.__doFetch("players/" + player_id + "/claims", 'PUT', payload);
|
return this.__doFetch("players/" + player_id + "/claims", 'PUT', payload);
|
||||||
},
|
},
|
||||||
unClaim (player_id, item_id) {
|
unClaim (player_id, item_id) {
|
||||||
const payload = { player_id, item_id };
|
const payload = item_id;
|
||||||
return this.__doFetch("players/" + player_id + "/claims", 'DELETE', payload);
|
return this.__doFetch("players/" + player_id + "/claims", 'DELETE', payload);
|
||||||
},
|
},
|
||||||
updateWealth (player_id, value_in_gp) {
|
updateWealth (player_id, value_in_gp) {
|
||||||
const payload = { player_id, value_in_gp: Number(value_in_gp) };
|
const payload = Number(value_in_gp);
|
||||||
return this.__doFetch("players/" + player_id + "/wealth", 'PUT', payload);
|
return this.__doFetch("players/" + player_id + "/wealth", 'PUT', payload);
|
||||||
},
|
},
|
||||||
buyItems (player_id, items) {
|
buyItems (player_id, items) {
|
||||||
const payload = { player_id, items };
|
const payload = items;
|
||||||
return this.__doFetch("players/" + player_id + "/loot", 'PUT', payload);
|
return this.__doFetch("players/" + player_id + "/loot", 'PUT', payload);
|
||||||
},
|
},
|
||||||
sellItems (player_id, items) {
|
sellItems (player_id, items) {
|
||||||
const payload = { player_id, items };
|
const payload = items;
|
||||||
return this.__doFetch("players/" + player_id + "/loot", 'DELETE', payload);
|
return this.__doFetch("players/" + player_id + "/loot", 'DELETE', payload);
|
||||||
},
|
},
|
||||||
newLoot (items) {
|
newLoot (items) {
|
||||||
@@ -84,10 +84,10 @@ export const AppStorage = {
|
|||||||
])
|
])
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const [players, claims, inventory, group_loot] = data;
|
const [players, claims, inventory, group_loot] = data;
|
||||||
this.__initPlayerList(players);
|
this.__initPlayerList(players.value);
|
||||||
this.__initClaimsStore(claims);
|
this.__initClaimsStore(claims.value);
|
||||||
Vue.set(this.state, 'group_loot', group_loot);
|
Vue.set(this.state, 'group_loot', group_loot.value);
|
||||||
Vue.set(this.state, 'inventory', inventory);
|
Vue.set(this.state, 'inventory', inventory.value);
|
||||||
})
|
})
|
||||||
.then(_ => this.state.initiated = true)
|
.then(_ => this.state.initiated = true)
|
||||||
.catch(e => { alert(e); this.state.initiated = false });
|
.catch(e => { alert(e); this.state.initiated = false });
|
||||||
|
|||||||
Reference in New Issue
Block a user