add methodes to update hide amounts

This commit is contained in:
ogerly 2023-01-10 10:07:47 +01:00
parent ae5c5984b8
commit b139834729
4 changed files with 56 additions and 4 deletions

View File

@ -39,7 +39,7 @@
<b-icon <b-icon
:icon="hideAmount ? 'eye-slash' : 'eye'" :icon="hideAmount ? 'eye-slash' : 'eye'"
class="mr-3 gradido-global-border-color-accent pointer hover-icon" class="mr-3 gradido-global-border-color-accent pointer hover-icon"
@click="$store.commit('hideAmountGDD', !hideAmount)" @click="updateHideAmountGDD"
></b-icon> ></b-icon>
</b-col> </b-col>
</b-row> </b-row>
@ -47,6 +47,8 @@
</div> </div>
</template> </template>
<script> <script>
import { updateUserInfos } from '@/graphql/mutations'
export default { export default {
name: 'GddAmount', name: 'GddAmount',
props: { props: {
@ -60,5 +62,27 @@ export default {
return this.$store.state.hideAmountGDD return this.$store.state.hideAmountGDD
}, },
}, },
methods: {
async updateHideAmountGDD() {
this.$apollo
.mutate({
mutation: updateUserInfos,
variables: {
hideAmountGDD: !this.hideAmount,
},
})
.then(() => {
this.$store.commit('hideAmountGDD', !this.hideAmount)
if (!this.hideAmount) {
this.toastSuccess(this.$t('settings.showAmountGDD'))
} else {
this.toastSuccess(this.$t('settings.hideAmountGDD'))
}
})
.catch((error) => {
this.toastError(error.message)
})
},
},
} }
</script> </script>

View File

@ -34,7 +34,7 @@
<b-icon <b-icon
:icon="hideAmount ? 'eye-slash' : 'eye'" :icon="hideAmount ? 'eye-slash' : 'eye'"
class="mr-3 gradido-global-border-color-accent pointer hover-icon" class="mr-3 gradido-global-border-color-accent pointer hover-icon"
@click="$store.commit('hideAmountGDT', !hideAmount)" @click="updateHideAmountGDT"
></b-icon> ></b-icon>
</b-col> </b-col>
</b-row> </b-row>
@ -42,6 +42,8 @@
</div> </div>
</template> </template>
<script> <script>
import { updateUserInfos } from '@/graphql/mutations'
export default { export default {
name: 'GdtAmount', name: 'GdtAmount',
props: { props: {
@ -54,5 +56,27 @@ export default {
return this.$store.state.hideAmountGDT return this.$store.state.hideAmountGDT
}, },
}, },
methods: {
async updateHideAmountGDT() {
this.$apollo
.mutate({
mutation: updateUserInfos,
variables: {
hideAmountGDT: !this.hideAmount,
},
})
.then(() => {
this.$store.commit('hideAmountGDT', !this.hideAmount)
if (!this.hideAmount) {
this.toastSuccess(this.$t('settings.showAmountGDT'))
} else {
this.toastSuccess(this.$t('settings.hideAmountGDT'))
}
})
.catch((error) => {
this.toastError(error.message)
})
},
},
} }
</script> </script>

View File

@ -31,8 +31,8 @@ export const updateUserInfos = gql`
$password: String $password: String
$passwordNew: String $passwordNew: String
$locale: String $locale: String
$hideAmountGDD: boolean! $hideAmountGDD: Boolean
$hideAmountGDT: boolean! $hideAmountGDT: Boolean
) { ) {
updateUserInfos( updateUserInfos(
firstName: $firstName firstName: $firstName

View File

@ -269,6 +269,10 @@
"warningText": "Bist du noch da?" "warningText": "Bist du noch da?"
}, },
"settings": { "settings": {
"showAmountGDD": "Dein GDD Betrag ist sichtbar.",
"hideAmountGDD": "Dein GDD Betrag ist versteckt.",
"showAmountGDT": "Dein GDT Betrag ist sichtbar.",
"hideAmountGDT": "Dein GDT Betrag ist versteckt.",
"language": { "language": {
"changeLanguage": "Sprache ändern", "changeLanguage": "Sprache ändern",
"de": "Deutsch", "de": "Deutsch",