Form submission caching & url pre-fill confusion (#37)
* Form submission caching & url pre-fill confusion * formPendingSubmissionKey as common mixins * Rename mixin formPendingSubmissionKey Co-authored-by: Julien Nahum <jhumanj@MacBook-Pro-de-Julien.local>
This commit is contained in:
@@ -124,6 +124,7 @@ import OpenFormButton from './OpenFormButton'
|
||||
import { themes } from '~/config/form-themes'
|
||||
import VButton from '../../common/Button'
|
||||
import VTransition from '../../common/transitions/VTransition'
|
||||
import FormPendingSubmissionKey from '../../../mixins/forms/form-pending-submission-key'
|
||||
|
||||
export default {
|
||||
components: { VTransition, VButton, OpenFormButton, OpenForm },
|
||||
@@ -133,6 +134,8 @@ export default {
|
||||
creating: { type: Boolean, default: false } // If true, fake form submit
|
||||
},
|
||||
|
||||
mixins: [FormPendingSubmissionKey],
|
||||
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
@@ -193,7 +196,7 @@ export default {
|
||||
})
|
||||
|
||||
try {
|
||||
window.localStorage.removeItem(this.form.form_pending_submission_key)
|
||||
window.localStorage.removeItem(this.formPendingSubmissionKey)
|
||||
} catch (e) {}
|
||||
|
||||
if (response.data.redirect && response.data.redirect_url) {
|
||||
|
||||
@@ -63,10 +63,12 @@ import OpenFormButton from './OpenFormButton'
|
||||
import clonedeep from 'clone-deep'
|
||||
import FormLogicPropertyResolver from '../../../forms/FormLogicPropertyResolver'
|
||||
const VueHcaptcha = () => import('@hcaptcha/vue-hcaptcha')
|
||||
import FormPendingSubmissionKey from '../../../mixins/forms/form-pending-submission-key'
|
||||
|
||||
export default {
|
||||
name: 'OpenForm',
|
||||
components: { OpenFormButton, VueHcaptcha },
|
||||
mixins: [FormPendingSubmissionKey],
|
||||
props: {
|
||||
form: {
|
||||
type: Object,
|
||||
@@ -223,7 +225,7 @@ export default {
|
||||
handler () {
|
||||
if(this.isPublicFormPage && this.form && this.dataFormValue){
|
||||
try {
|
||||
window.localStorage.setItem(this.form.form_pending_submission_key, JSON.stringify(this.dataFormValue))
|
||||
window.localStorage.setItem(this.formPendingSubmissionKey, JSON.stringify(this.dataFormValue))
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
@@ -279,7 +281,7 @@ export default {
|
||||
if (this.isPublicFormPage) {
|
||||
let pendingData
|
||||
try {
|
||||
pendingData = window.localStorage.getItem(this.form.form_pending_submission_key)
|
||||
pendingData = window.localStorage.getItem(this.formPendingSubmissionKey)
|
||||
} catch (e) {
|
||||
pendingData = null
|
||||
}
|
||||
@@ -288,7 +290,7 @@ export default {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const formData = clonedeep(this.dataForm ? this.dataForm.data() : {})
|
||||
let urlPrefill = null
|
||||
if (this.isPublicFormPage && this.form.is_pro) {
|
||||
|
||||
Reference in New Issue
Block a user