1
0
Fork 0
mirror of https://github.com/em-squared/5e-drs.git synced 2025-10-30 13:14:20 +00:00

ajout de l'option imprimable sur chaque sort dans le grimoire personnel. see #18

This commit is contained in:
Maxime Moraine 2020-05-04 11:25:26 +02:00
parent 9dae3aec37
commit e6c38d156a
2 changed files with 40 additions and 6 deletions

View file

@ -5,7 +5,8 @@ export default {
state: {
spells: [],
spellSlots: []
spellSlots: [],
notPrintedSpells: []
},
getters: {
@ -34,6 +35,7 @@ export default {
let localStorageData = JSON.parse(localStorage.getItem('mySpells'))
state.spells = localStorageData.spells
state.spellSlots = localStorageData.spellSlots
state.notPrintedSpells = localStorageData.notPrintedSpells
}
},
setSpells: (state, payload) => {
@ -63,6 +65,18 @@ export default {
setSpellSlots: (state, payload) => {
state.spellSlots = payload
},
addNotPrintedSpell: (state, payload) => {
let spellIndex = state.notPrintedSpells.findIndex(spell => spell.key == payload.key)
if (!spellIndex >= 0) {
state.notPrintedSpells.push(payload)
}
},
removeNotPrintedSpell: (state, payload) => {
let spellIndex = state.notPrintedSpells.findIndex(spell => spell.key == payload.key)
if (spellIndex >= 0) {
state.notPrintedSpells.splice(spellIndex, 1)
}
}
}
}