1
0
Fork 0

Added wipe spellbook functionality

This commit is contained in:
sharpshark28 2017-05-25 17:36:14 -05:00
parent 95a5a3b181
commit 0d83a3374b
2 changed files with 33 additions and 1 deletions

View file

@ -6,6 +6,16 @@
web-based application to elegantly view spells and save them to your local spellbook.
</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>
<p>
Open Game License v1.0a Copyright 2000, Wizards of the Coast, Inc.
@ -30,9 +40,27 @@
</template>
<script>
import { Toast } from 'quasar'
import { dispatch, state } from '../store'
export default {
data () {
return {}
return { state }
},
computed: {
disableChosen () {
return this.state.chosen.length === 0
}
},
methods: {
wipeChosen () {
dispatch({
type: 'WIPE_CHOSEN'
})
Toast.create({
html: 'Spellbook Reset'
})
}
}
}
</script>

View file

@ -20,6 +20,10 @@ export function dispatch (action) {
case 'LOAD_LOCAL_CHOSEN' :
state.chosen = LocalStorage.get.item('chosen').split(',')
break
case 'WIPE_CHOSEN':
state.chosen = []
LocalStorage.remove('chosen')
break
case 'CHANGE_CHOSEN':
if (action.data.want) {
state.chosen.push(action.data.name)