Only renders grecaptcha after metadata is loaded.
This commit is contained in:
parent
698ff10541
commit
d59d1859a2
|
@ -340,6 +340,7 @@
|
||||||
<template v-if="useCaptcha == 'yes'">
|
<template v-if="useCaptcha == 'yes'">
|
||||||
<div
|
<div
|
||||||
class="g-recaptcha"
|
class="g-recaptcha"
|
||||||
|
id="tainacan-g-recaptcha"
|
||||||
:data-sitekey="captchaSiteKey" />
|
:data-sitekey="captchaSiteKey" />
|
||||||
<br>
|
<br>
|
||||||
</template>
|
</template>
|
||||||
|
@ -507,7 +508,6 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
// Puts loading on form
|
// Puts loading on form
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
|
||||||
|
@ -542,6 +542,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
// Checks if only one type of document is allowed. In this case we preset document type
|
// Checks if only one type of document is allowed. In this case we preset document type
|
||||||
if (!this.hideFileModalButton && this.hideTextModalButton && this.hideLinkModalButton)
|
if (!this.hideFileModalButton && this.hideTextModalButton && this.hideLinkModalButton)
|
||||||
this.form.document_type = 'attachment';
|
this.form.document_type = 'attachment';
|
||||||
|
@ -677,6 +678,15 @@ export default {
|
||||||
this.setItemSubmissionMetadata( metadata.map((metadatum) => { return { metadatum_id: metadatum.id, value: null } }) );
|
this.setItemSubmissionMetadata( metadata.map((metadatum) => { return { metadatum_id: metadatum.id, value: null } }) );
|
||||||
this.couldLoadCollection = true;
|
this.couldLoadCollection = true;
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
|
|
||||||
|
// Mounts grecapcha
|
||||||
|
if (this.useCaptcha == 'yes') {
|
||||||
|
try {
|
||||||
|
grecaptcha.render('tainacan-g-recaptcha');
|
||||||
|
} catch(error) {
|
||||||
|
this.$console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.couldLoadCollection = false;
|
this.couldLoadCollection = false;
|
||||||
|
|
Loading…
Reference in New Issue