mirror of
https://github.com/em-squared/5e-drs.git
synced 2025-12-17 23:50:29 +00:00
refonte du grimoire personnel, suivi des emplacements de sorts par niveau
This commit is contained in:
parent
7cf83baed3
commit
9dae3aec37
6 changed files with 180 additions and 27 deletions
|
|
@ -45,7 +45,7 @@ export default {
|
|||
|
||||
methods: {
|
||||
download () {
|
||||
saveAs(new Blob([JSON.stringify(this.$store.state.mySpells.spells)], {
|
||||
saveAs(new Blob([JSON.stringify(this.$store.state.mySpells)], {
|
||||
type: "text/plain;charset=utf-8"
|
||||
}), "grimoire.json")
|
||||
},
|
||||
|
|
@ -58,15 +58,18 @@ export default {
|
|||
reader.onload = function() {
|
||||
let result = JSON.parse(reader.result)
|
||||
let isValid = true
|
||||
if (result.length >= 1) {
|
||||
for (var s of result) {
|
||||
if (result.spells && result.spells.length >= 1) {
|
||||
for (var s of result.spells) {
|
||||
if (s.pid !== 'spell') {
|
||||
isValid = false
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isValid) {
|
||||
self.$store.commit('mySpells/setSpells', result)
|
||||
self.$store.commit('mySpells/setSpells', result.spells)
|
||||
if (result.spellSlots) {
|
||||
self.$store.commit('mySpells/setSpellSlots', result.spellSlots)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue