Fix error with undefined this.callback

This commit is contained in:
Wolfgang Huß 2022-04-27 13:04:51 +02:00
parent 1eca96cf11
commit baac1d8dde

View File

@ -13,7 +13,7 @@
v-if="buttonText && (linkTo || callback)"
class="test-message-button"
:to="linkTo ? linkTo + (code ? `/${code}` : '') : null"
@click="callback()"
@click="optionalCallback()"
>
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
{{ buttonText }}
@ -36,5 +36,12 @@ export default {
callback: { type: Function, required: false, default: null },
code: { type: String, required: false, default: null }, // Wolle: to be removed by adding it directly to the "linkTo"
},
methods: {
optionalCallback() {
if (this.callback) {
this.callback()
}
},
},
}
</script>