From d59d1859a203f97ffce7c5ddf4258ad724ade559 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Thu, 12 Nov 2020 15:43:51 -0300 Subject: [PATCH] Only renders grecaptcha after metadata is loaded. --- .../item-submission/pages/item-submission-form.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/views/item-submission/pages/item-submission-form.vue b/src/views/item-submission/pages/item-submission-form.vue index 7c87ea194..5982b15cb 100644 --- a/src/views/item-submission/pages/item-submission-form.vue +++ b/src/views/item-submission/pages/item-submission-form.vue @@ -340,6 +340,7 @@ @@ -507,7 +508,6 @@ export default { } }, created() { - // Puts loading on form this.isLoading = true; @@ -542,6 +542,7 @@ export default { }); }, mounted() { + // Checks if only one type of document is allowed. In this case we preset document type if (!this.hideFileModalButton && this.hideTextModalButton && this.hideLinkModalButton) this.form.document_type = 'attachment'; @@ -677,6 +678,15 @@ export default { this.setItemSubmissionMetadata( metadata.map((metadatum) => { return { metadatum_id: metadatum.id, value: null } }) ); this.couldLoadCollection = true; this.isLoading = false; + + // Mounts grecapcha + if (this.useCaptcha == 'yes') { + try { + grecaptcha.render('tainacan-g-recaptcha'); + } catch(error) { + this.$console.log(error); + } + } }) .catch(() => { this.couldLoadCollection = false;