Added wipe spellbook functionality
This commit is contained in:
parent
95a5a3b181
commit
0d83a3374b
2 changed files with 33 additions and 1 deletions
|
@ -6,6 +6,16 @@
|
||||||
web-based application to elegantly view spells and save them to your local spellbook.
|
web-based application to elegantly view spells and save them to your local spellbook.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<h2>Settings</h2>
|
||||||
|
<button
|
||||||
|
class="primary"
|
||||||
|
v-on:click="wipeChosen"
|
||||||
|
:disabled="disableChosen"
|
||||||
|
>
|
||||||
|
<i class="on-left">delete</i>
|
||||||
|
Reset Spellbook
|
||||||
|
</button>
|
||||||
|
|
||||||
<h2>License</h2>
|
<h2>License</h2>
|
||||||
<p>
|
<p>
|
||||||
Open Game License v1.0a Copyright 2000, Wizards of the Coast, Inc.
|
Open Game License v1.0a Copyright 2000, Wizards of the Coast, Inc.
|
||||||
|
@ -30,9 +40,27 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { Toast } from 'quasar'
|
||||||
|
import { dispatch, state } from '../store'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {}
|
return { state }
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
disableChosen () {
|
||||||
|
return this.state.chosen.length === 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
wipeChosen () {
|
||||||
|
dispatch({
|
||||||
|
type: 'WIPE_CHOSEN'
|
||||||
|
})
|
||||||
|
Toast.create({
|
||||||
|
html: 'Spellbook Reset'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -20,6 +20,10 @@ export function dispatch (action) {
|
||||||
case 'LOAD_LOCAL_CHOSEN' :
|
case 'LOAD_LOCAL_CHOSEN' :
|
||||||
state.chosen = LocalStorage.get.item('chosen').split(',')
|
state.chosen = LocalStorage.get.item('chosen').split(',')
|
||||||
break
|
break
|
||||||
|
case 'WIPE_CHOSEN':
|
||||||
|
state.chosen = []
|
||||||
|
LocalStorage.remove('chosen')
|
||||||
|
break
|
||||||
case 'CHANGE_CHOSEN':
|
case 'CHANGE_CHOSEN':
|
||||||
if (action.data.want) {
|
if (action.data.want) {
|
||||||
state.chosen.push(action.data.name)
|
state.chosen.push(action.data.name)
|
||||||
|
|
Loading…
Add table
Reference in a new issue