It looks like the issue is with how the modal variable is being passed and updated in the submitMakeNewCat function. Instead of setting modal to false, you should update the value of isNewCatOpen to false.
Here's an updated version of the submitMakeNewCat function:
const submitMakeNewCat = () => {
form.post(route('admin.categories.store'), {
onFinish: () => {
form.name = '';
form.slug = '';
form.parent_id = '';
isNewCatOpen.value = false;
},
});
}
And in your template, you can remove the isNewCatOpen parameter from the submitMakeNewCat method call:
<form @submit.prevent="submitMakeNewCat" class="mt-4">
<div>...</div>
</form>
This should update the value of isNewCatOpen to false when the form is submitted, which will close the modal.