From dac00c460859fb08139e8e64a58902926972b7c8 Mon Sep 17 00:00:00 2001 From: dnwjn Date: Sat, 5 Feb 2022 23:39:18 +0100 Subject: [PATCH] Check if all variables are set before making request Fixes https://github.com/dillingham/nova-button/issues/91 --- resources/js/components/NovaButton.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/js/components/NovaButton.vue b/resources/js/components/NovaButton.vue index 26fede0..b930883 100644 --- a/resources/js/components/NovaButton.vue +++ b/resources/js/components/NovaButton.vue @@ -37,7 +37,7 @@ export default { error: false, }), mounted() { - this.$nextTick(function() { + this.$nextTick(() => { this.buttonWidth = this.$refs.novabutton.clientWidth + 2 + 'px'; }); }, @@ -75,6 +75,10 @@ export default { post() { this.$emit('loading'); + if (_.isEmpty(this.resourceName) || _.isEmpty(this.resourceId) || _.isEmpty(this.field?.key)) { + return; + } + window.setTimeout(() => { this.loading = true; }, 200);