diff --git a/client/components/global/Modal.vue b/client/components/global/Modal.vue index c075e7c..d830c96 100644 --- a/client/components/global/Modal.vue +++ b/client/components/global/Modal.vue @@ -49,129 +49,123 @@ - diff --git a/client/components/open/forms/components/FormEditor.vue b/client/components/open/forms/components/FormEditor.vue index beafa5a..1a6ac96 100644 --- a/client/components/open/forms/components/FormEditor.vue +++ b/client/components/open/forms/components/FormEditor.vue @@ -161,7 +161,7 @@ export default { showFormErrorModal: false, validationErrorResponse: null, updateFormLoading: false, - createdFormId: null + createdFormSlug: null } }, @@ -176,7 +176,7 @@ export default { } }, createdForm () { - return this.formsStore.getById(this.createdFormId) + return this.formsStore.getBySlug(this.createdFormSlug) }, workspace () { return this.workspacesStore.getCurrent() @@ -278,7 +278,7 @@ export default { this.form.post('/api/open/forms').then((response) => { this.formsStore.addOrUpdate(response.data.form) this.$emit('on-save') - this.createdFormId = response.data.form.id + this.createdFormSlug = response.data.form.slug this.$logEvent('form_created', { form_id: response.data.form.id, form_slug: response.data.form.slug }) this.$crisp.push(['set', 'session:event', [[['form_created', { diff --git a/client/pages/home.vue b/client/pages/home.vue index 0aef45e..271a3f1 100644 --- a/client/pages/home.vue +++ b/client/pages/home.vue @@ -47,9 +47,9 @@

No forms found

-
- Your search "{{ searchForm.search }}" did not match any forms. Please try again. + Your search "{{ search }}" did not match any forms. Please try again.
- @@ -45,7 +46,9 @@ :to="{name:'forms.edit', params: {slug: form.slug}}" class="block block px-4 py-2 text-md text-gray-700 dark:text-white hover:bg-gray-100 hover:text-gray-900 dark:text-gray-100 dark:hover:text-white dark:hover:bg-gray-600 flex items-center" > - + - + Copy link to share @@ -134,7 +140,9 @@ - + @@ -159,6 +167,7 @@ export default { const formsStore = useFormsStore() return { formsStore, + router: useRouter(), user: computed(() => authStore.user) } }, @@ -187,9 +196,9 @@ export default { duplicateForm () { if (this.loadingDuplicate) return this.loadingDuplicate = true - axios.post(this.formEndpoint.replace('{id}', this.form.id) + '/duplicate').then((response) => { - this.formsStore.addOrUpdate(response.data.new_form) - this.$router.push({ name: 'forms.show', params: { slug: response.data.new_form.slug } }) + opnFetch(this.formEndpoint.replace('{id}', this.form.id) + '/duplicate', { method: 'POST' }).then((response) => { + this.formsStore.save(response.data.new_form) + this.router.push({ name: 'forms.show', params: { slug: response.data.new_form.slug } }) this.alertSuccess('Form was successfully duplicated.') this.loadingDuplicate = false }) @@ -198,8 +207,8 @@ export default { if (this.loadingDelete) return this.loadingDelete = true axios.delete(this.formEndpoint.replace('{id}', this.form.id)).then(() => { - this.formsStore.remove(this.form) - this.$router.push({ name: 'home' }) + this.formsStore.remove(this.form.id) + this.router.push({ name: 'home' }) this.alertSuccess('Form was deleted.') this.loadingDelete = false })