Nuxt Migration notifications (#265)

* Nuxt Migration notifications

* @input to @update:model-value

* change field type fixes

* @update:model-value

* Enable form-block-logic-editor

* vue-confetti migration

* PR request changes

* useAlert in setup
This commit is contained in:
formsdev
2023-12-31 17:09:01 +05:30
committed by GitHub
parent b4365b5e30
commit 6fd2985ff5
38 changed files with 586 additions and 1390 deletions

View File

@@ -129,10 +129,10 @@ export default {
// AppSumo License
if (data.appsumo_license === false) {
this.alertError('Invalid AppSumo license. This probably happened because this license was already' +
useAlert().error('Invalid AppSumo license. This probably happened because this license was already' +
' attached to another OpnForm account. Please contact support.')
} else if (data.appsumo_license === true) {
this.alertSuccess('Your AppSumo license was successfully activated! You now have access to all the' +
useAlert().success('Your AppSumo license was successfully activated! You now have access to all the' +
' features of the AppSumo deal.')
}

View File

@@ -97,7 +97,11 @@ export default {
props: {
show: { type: Boolean, required: true }
},
setup () {
return {
useAlert: useAlert()
}
},
data: () => ({
state: 'default',
aiForm: useForm({
@@ -118,10 +122,10 @@ export default {
this.loading = true
this.aiForm.post('/api/forms/ai/generate').then(response => {
this.alertSuccess(response.data.message)
this.useAlert.success(response.data.message)
this.fetchGeneratedForm(response.data.ai_form_completion_id)
}).catch(error => {
this.alertError(error.response.data.message)
this.useAlert.error(error.response.data.message)
this.loading = false
this.state = 'default'
})
@@ -131,18 +135,18 @@ export default {
setTimeout(() => {
axios.get('/api/forms/ai/' + generationId).then(response => {
if (response.data.ai_form_completion.status === 'completed') {
this.alertSuccess(response.data.message)
this.useAlert.success(response.data.message)
this.$emit('form-generated', JSON.parse(response.data.ai_form_completion.result))
this.$emit('close')
} else if (response.data.ai_form_completion.status === 'failed') {
this.alertError('Something went wrong, please try again.')
this.useAlert.error('Something went wrong, please try again.')
this.state = 'default'
this.loading = false
} else {
this.fetchGeneratedForm(generationId)
}
}).catch(error => {
this.alertError(error.response.data.message)
this.useAlert.error(error.response.data.message)
this.state = 'default'
this.loading = false
})

View File

@@ -157,7 +157,8 @@ export default {
const formsStore = useFormsStore()
return {
formsStore,
user: computed(() => authStore.user)
user: computed(() => authStore.user),
useAlert: useAlert()
}
},
@@ -180,7 +181,7 @@ export default {
el.select()
document.execCommand('copy')
document.body.removeChild(el)
this.alertSuccess('Copied!')
this.useAlert.success('Copied!')
},
duplicateForm () {
if (this.loadingDuplicate) return
@@ -188,7 +189,7 @@ export default {
opnFetch(this.formEndpoint.replace('{id}', this.form.id) + '/duplicate',{method: 'POST'}).then((data) => {
this.formsStore.save(data.new_form)
this.$router.push({ name: 'forms-show', params: { slug: data.new_form.slug } })
this.alertSuccess('Form was successfully duplicated.')
this.useAlert.success('Form was successfully duplicated.')
this.loadingDuplicate = false
})
},
@@ -198,7 +199,7 @@ export default {
opnFetch(this.formEndpoint.replace('{id}', this.form.id),{method:'DELETE'}).then(() => {
this.formsStore.remove(this.form)
this.$router.push({ name: 'home' })
this.alertSuccess('Form was deleted.')
this.useAlert.success('Form was deleted.')
this.loadingDelete = false
})
}

View File

@@ -106,7 +106,7 @@ export default {
axios.put(this.formEndpoint.replace('{id}', this.form.id) + '/regenerate-link/' + option).then((response) => {
this.formsStore.addOrUpdate(response.data.form)
this.$router.push({name: 'forms-slug-show-share', params: {slug: response.data.form.slug}})
this.alertSuccess(response.data.message)
useAlert().success(response.data.message)
this.loadingNewLink = false
}).finally(() => {
this.showGenerateFormLinkModal = false

View File

@@ -84,7 +84,7 @@ export default {
axios.get('/api/subscription/new/' + this.plan + '/' + (!this.yearly ? 'monthly' : 'yearly') + '/checkout/with-trial').then((response) => {
window.location = response.data.checkout_url
}).catch((error) => {
this.alertError(error.response.data.message)
useAlert().error(error.response.data.message)
}).finally(() => {
this.loading = false
this.close()