From a0c602823049e589be70003e1010860d3aba5681 Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Sat, 27 Feb 2021 07:58:58 -0500 Subject: [PATCH] Standardize form submit handlers --- resources/js/Pages/Auth/Login.vue | 4 ++-- resources/js/Pages/Contacts/Create.vue | 7 ++++++- resources/js/Pages/Contacts/Edit.vue | 5 ++++- resources/js/Pages/Organizations/Create.vue | 7 ++++++- resources/js/Pages/Organizations/Edit.vue | 5 ++++- resources/js/Pages/Users/Create.vue | 7 ++++++- resources/js/Pages/Users/Edit.vue | 4 ++-- 7 files changed, 30 insertions(+), 9 deletions(-) diff --git a/resources/js/Pages/Auth/Login.vue b/resources/js/Pages/Auth/Login.vue index c4d5e80..55175e6 100644 --- a/resources/js/Pages/Auth/Login.vue +++ b/resources/js/Pages/Auth/Login.vue @@ -2,7 +2,7 @@
-
+

Welcome Back!

@@ -44,7 +44,7 @@ export default { } }, methods: { - submit() { + login() { this.form .transform(data => ({ ...data, diff --git a/resources/js/Pages/Contacts/Create.vue b/resources/js/Pages/Contacts/Create.vue index 299a80c..a20b69e 100644 --- a/resources/js/Pages/Contacts/Create.vue +++ b/resources/js/Pages/Contacts/Create.vue @@ -5,7 +5,7 @@ / Create
- +
@@ -67,5 +67,10 @@ export default { }), } }, + methods: { + store() { + this.form.post(this.route('contacts.store')) + }, + }, } diff --git a/resources/js/Pages/Contacts/Edit.vue b/resources/js/Pages/Contacts/Edit.vue index 7c09514..c6a8449 100644 --- a/resources/js/Pages/Contacts/Edit.vue +++ b/resources/js/Pages/Contacts/Edit.vue @@ -9,7 +9,7 @@ This contact has been deleted.
- +
@@ -81,6 +81,9 @@ export default { } }, methods: { + update() { + this.form.put(this.route('contacts.update', this.contact.id)) + }, destroy() { if (confirm('Are you sure you want to delete this contact?')) { this.$inertia.delete(this.route('contacts.destroy', this.contact.id)) diff --git a/resources/js/Pages/Organizations/Create.vue b/resources/js/Pages/Organizations/Create.vue index 67cff74..590c969 100644 --- a/resources/js/Pages/Organizations/Create.vue +++ b/resources/js/Pages/Organizations/Create.vue @@ -5,7 +5,7 @@ / Create
- +
@@ -57,5 +57,10 @@ export default { }), } }, + methods: { + store() { + this.form.post(this.route('organizations.store')) + }, + }, } diff --git a/resources/js/Pages/Organizations/Edit.vue b/resources/js/Pages/Organizations/Edit.vue index 186a689..66bc2ae 100644 --- a/resources/js/Pages/Organizations/Edit.vue +++ b/resources/js/Pages/Organizations/Edit.vue @@ -9,7 +9,7 @@ This organization has been deleted.
- +
@@ -108,6 +108,9 @@ export default { } }, methods: { + update() { + this.form.put(this.route('organizations.update', this.organization.id)) + }, destroy() { if (confirm('Are you sure you want to delete this organization?')) { this.$inertia.delete(this.route('organizations.destroy', this.organization.id)) diff --git a/resources/js/Pages/Users/Create.vue b/resources/js/Pages/Users/Create.vue index f28e3d0..b7bb0c6 100644 --- a/resources/js/Pages/Users/Create.vue +++ b/resources/js/Pages/Users/Create.vue @@ -5,7 +5,7 @@ / Create
- +
@@ -54,5 +54,10 @@ export default { }), } }, + methods: { + store() { + this.form.post(this.route('users.store')) + }, + }, } diff --git a/resources/js/Pages/Users/Edit.vue b/resources/js/Pages/Users/Edit.vue index 10a16a3..e0bf2c9 100644 --- a/resources/js/Pages/Users/Edit.vue +++ b/resources/js/Pages/Users/Edit.vue @@ -12,7 +12,7 @@ This user has been deleted.
- +
@@ -73,7 +73,7 @@ export default { } }, methods: { - submit() { + update() { this.form.post(this.route('users.update', this.user.id), { onSuccess: () => this.form.reset('password', 'photo'), })