diff --git a/resources/js/Pages/Users/Edit.vue b/resources/js/Pages/Users/Edit.vue
index 9e385f6..7c0b2e0 100644
--- a/resources/js/Pages/Users/Edit.vue
+++ b/resources/js/Pages/Users/Edit.vue
@@ -12,21 +12,21 @@
This user has been deleted.
@@ -56,45 +56,23 @@ export default {
TrashedMessage,
},
props: {
- errors: Object,
user: Object,
},
remember: 'form',
data() {
return {
- sending: false,
- form: {
+ form: this.$inertia.form({
+ _method: 'put',
first_name: this.user.first_name,
last_name: this.user.last_name,
email: this.user.email,
password: this.user.password,
owner: this.user.owner,
photo: null,
- },
+ }),
}
},
methods: {
- submit() {
- var data = new FormData()
- data.append('first_name', this.form.first_name || '')
- data.append('last_name', this.form.last_name || '')
- data.append('email', this.form.email || '')
- data.append('password', this.form.password || '')
- data.append('owner', this.form.owner ? '1' : '0')
- data.append('photo', this.form.photo || '')
- data.append('_method', 'put')
-
- this.$inertia.post(this.route('users.update', this.user.id), data, {
- onStart: () => this.sending = true,
- onFinish: () => this.sending = false,
- onSuccess: () => {
- if (Object.keys(this.$page.props.errors).length === 0) {
- this.form.photo = null
- this.form.password = null
- }
- },
- })
- },
destroy() {
if (confirm('Are you sure you want to delete this user?')) {
this.$inertia.delete(this.route('users.destroy', this.user.id))