Skip to content

Commit

Permalink
🐞 Fix share battle by removing unimplemented creature fields
Browse files Browse the repository at this point in the history
  • Loading branch information
vforvasile committed Apr 4, 2023
1 parent 5761e24 commit 01f7546
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/state/SyncManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ export function share(state, createBattle, updateBattle, date) {
if (!state.shareEnabled) {
return state;
}
// remove additional data from creatures to fix share battle
const newCreatures = state.creatures.map((creature) => {
const {
spellData, apiData, armorClass, ...rest
} = creature;
return rest;
});

const battleId = state.battleId || nanoid(11);

Expand All @@ -13,7 +20,7 @@ export function share(state, createBattle, updateBattle, date) {
battleinput: {
battleId,
round: state.round,
creatures: state.creatures,
creatures: newCreatures,
activeCreature: state.activeCreature,
expdate: Math.floor(date.getTime() / 1000.0) + 86400,
},
Expand Down

0 comments on commit 01f7546

Please sign in to comment.