[Vuejs]-Laravel Inertia Vue

0👍

Try Inertia.put() instead, since you sending it via PUT request. Also I think you can also use form.put() so that you don’t to type the attributes again. just make sure that the const form = useForm().

0👍

You could also use the Inertia.form().

 <script setup>
    import { Inertia } from '@inertiajs/inertia';

    const props = defineProps({
    user: Object,
    avatar: String,
    });

const form = Inertia.form({
    username: props.user.username,
    name: props.user.name,
    lastname: props.user.lastname,
    email: props.user.email,
    role_id: props.user.role_id,
    avatar: null,
});

function updateUser() {
  form.put(`/dashboard/users/${props.user.id}`, form)
}
</script>

Leave a comment