#Page data is not updating after delete operation,

1 messages · Page 1 of 1 (latest)

frank lily
#

in Inertia-vue, When i perform delete operation, delete operation is successful but data is not updated automatically, I have to reload the page manually.

<script setup>
import AuthenticatedLayout from "@/Layouts/AuthenticatedLayout.vue";
import { Head, Link, usePage, useForm, router } from "@inertiajs/vue3";
import Avatar from 'primevue/avatar';
import Button from 'primevue/button';

const {pages} = usePage().props;
const formatDate = (dateString) => {
  const date = new Date(dateString);
  return date.toLocaleDateString();
};
const form = useForm({
  id: null
});
const deletePage = (id) => {

  form.delete(route('page.destroy', id), {
    preserveScroll: true,
  });
}
</script>```
frosty frigate
#

This is probably because you're using the useForm helper, which doesn't do two-way binding. So the ID would remain the same as it was previously. So instead of using the form helper, why not just use Inertia's router to make a request? Or do you rely on other features from the helper?