Fix edit user form resetting
This commit is contained in:
		
							parent
							
								
									3c9d00deeb
								
							
						
					
					
						commit
						9a01ae5e11
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		|  | @ -12,7 +12,7 @@ | ||||||
|       This user has been deleted. |       This user has been deleted. | ||||||
|     </trashed-message> |     </trashed-message> | ||||||
|     <div class="bg-white rounded shadow overflow-hidden max-w-3xl"> |     <div class="bg-white rounded shadow overflow-hidden max-w-3xl"> | ||||||
|       <form @submit.prevent="form.post(route('users.update', user.id))"> |       <form @submit.prevent="submit"> | ||||||
|         <div class="p-8 -mr-6 -mb-8 flex flex-wrap"> |         <div class="p-8 -mr-6 -mb-8 flex flex-wrap"> | ||||||
|           <text-input v-model="form.first_name" :error="form.errors.first_name" class="pr-6 pb-8 w-full lg:w-1/2" label="First name" /> |           <text-input v-model="form.first_name" :error="form.errors.first_name" class="pr-6 pb-8 w-full lg:w-1/2" label="First name" /> | ||||||
|           <text-input v-model="form.last_name" :error="form.errors.last_name" class="pr-6 pb-8 w-full lg:w-1/2" label="Last name" /> |           <text-input v-model="form.last_name" :error="form.errors.last_name" class="pr-6 pb-8 w-full lg:w-1/2" label="Last name" /> | ||||||
|  | @ -66,13 +66,18 @@ export default { | ||||||
|         first_name: this.user.first_name, |         first_name: this.user.first_name, | ||||||
|         last_name: this.user.last_name, |         last_name: this.user.last_name, | ||||||
|         email: this.user.email, |         email: this.user.email, | ||||||
|         password: this.user.password, |         password: null, | ||||||
|         owner: this.user.owner, |         owner: this.user.owner, | ||||||
|         photo: null, |         photo: null, | ||||||
|       }), |       }), | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|  |     submit() { | ||||||
|  |       this.form.post(this.route('users.update', this.user.id), { | ||||||
|  |         onSuccess: () => this.form.reset('password', 'photo'), | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|     destroy() { |     destroy() { | ||||||
|       if (confirm('Are you sure you want to delete this user?')) { |       if (confirm('Are you sure you want to delete this user?')) { | ||||||
|         this.$inertia.delete(this.route('users.destroy', this.user.id)) |         this.$inertia.delete(this.route('users.destroy', this.user.id)) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Jonathan Reinink
						Jonathan Reinink