Removed unused toggleAll logic from gerty modal

This commit is contained in:
Black Coffee 2022-10-20 16:05:15 +01:00
parent dc02601db1
commit 60c88beb29

View file

@ -218,11 +218,12 @@
:disable="formDialog.data.wallet == null || formDialog.data.name == null" :disable="formDialog.data.wallet == null || formDialog.data.name == null"
type="submit" type="submit"
class="q-mr-md" class="q-mr-md"
v-if="!formDialog.data.id"
>Create Gerty >Create Gerty
</q-btn </q-btn
> >
<q-btn <q-btn
v-if="formDialog.data.id" v-else
unelevated unelevated
color="primary" color="primary"
:disable="formDialog.data.wallet == null || formDialog.data.name == null" :disable="formDialog.data.wallet == null || formDialog.data.name == null"
@ -257,14 +258,6 @@
mixins: [windowMixin], mixins: [windowMixin],
data: function () { data: function () {
return { return {
toggleStates: {
fun: true,
onchain: true,
mempool: true,
mining: true,
lightning: true
},
oldToggleStates: {},
gertys: [], gertys: [],
currencyOptions: [ currencyOptions: [
'USD', 'USD',
@ -623,27 +616,6 @@
if (this.g.user.wallets.length) { if (this.g.user.wallets.length) {
this.getGertys() this.getGertys()
} }
},
watch: {
toggleStates: {
handler(toggleStatesValue) {
// Switch all the toggles in each section to the relevant state
for (const [toggleKey, toggleValue] of Object.entries(toggleStatesValue)) {
if (this.oldToggleStates[toggleKey] !== toggleValue) {
for (const [dpKey, dpValue] of Object.entries(this.formDialog.data.display_preferences)) {
if (dpKey.indexOf(toggleKey) === 0) {
this.formDialog.data.display_preferences[dpKey] = toggleValue
}
}
}
}
// This is a weird hack we have to use to get VueJS to persist the previous toggle state between
// watches. VueJS passes the old and new values by reference so when comparing objects they
// will have the same values unless we do this
this.oldToggleStates = JSON.parse(JSON.stringify(toggleStatesValue))
},
deep: true
}
} }
}) })
</script> </script>