Refactoring stores and templates pages to comp. api
This commit is contained in:
@@ -129,6 +129,12 @@ export default {
|
||||
submitButtonClass: { type: String, default: '' }
|
||||
},
|
||||
|
||||
setup() {
|
||||
return {
|
||||
isIframe: useIsIframe()
|
||||
}
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
@@ -143,11 +149,8 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
isIframe () {
|
||||
return window.location !== window.parent.location || window.frameElement
|
||||
},
|
||||
isEmbedPopup () {
|
||||
return window.location.href.includes('popup=true')
|
||||
return process.client && window.location.href.includes('popup=true')
|
||||
},
|
||||
theme () {
|
||||
return this.themes[this.themes.hasOwnProperty(this.form.theme) ? this.form.theme : 'default']
|
||||
@@ -156,7 +159,7 @@ export default {
|
||||
return this.$route.name === 'forms.show_public'
|
||||
},
|
||||
isHideTitle () {
|
||||
return this.form.hide_title || window.location.href.includes('hide_title=true')
|
||||
return this.form.hide_title || (process.client && window.location.href.includes('hide_title=true'))
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -106,7 +106,8 @@ export default {
|
||||
const workingFormStore = useWorkingFormStore()
|
||||
return {
|
||||
recordsStore,
|
||||
workingFormStore
|
||||
workingFormStore,
|
||||
darkModeEnabled: useDark()
|
||||
}
|
||||
},
|
||||
|
||||
@@ -118,7 +119,6 @@ export default {
|
||||
* Used to force refresh components by changing their keys
|
||||
*/
|
||||
formVersionId: 1,
|
||||
darkModeEnabled: document.body.classList.contains('dark'),
|
||||
isAutoSubmit: false,
|
||||
/**
|
||||
* If currently dragging a field
|
||||
@@ -259,7 +259,7 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.form.use_captcha) {
|
||||
if (this.form.use_captcha && process.client) {
|
||||
this.dataForm['h-captcha-response'] = document.getElementsByName('h-captcha-response')[0].value
|
||||
this.$refs.hcaptcha.reset()
|
||||
}
|
||||
@@ -291,6 +291,7 @@ export default {
|
||||
}
|
||||
|
||||
// Scroll to error
|
||||
if (process.server) return
|
||||
const elements = document.getElementsByClassName('has-error')
|
||||
if (elements.length > 0) {
|
||||
window.scroll({
|
||||
|
||||
@@ -161,7 +161,7 @@ export default {
|
||||
if (response.data.message) {
|
||||
this.alertSuccess(response.data.message)
|
||||
}
|
||||
this.templatesStore.addOrUpdate(response.data.data)
|
||||
this.templatesStore.save(response.data.data)
|
||||
this.$emit('close')
|
||||
})
|
||||
},
|
||||
@@ -171,7 +171,7 @@ export default {
|
||||
if (response.data.message) {
|
||||
this.alertSuccess(response.data.message)
|
||||
}
|
||||
this.templatesStore.addOrUpdate(response.data.data)
|
||||
this.templatesStore.save(response.data.data)
|
||||
this.$emit('close')
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user