To update the status field after submitting the form, you can use the Inertia.reload() method to reload the current page. This will fetch the updated data from the server and re-render the page with the new data.
Here's an example of how you can use Inertia.reload() after submitting the form:
// Import the Inertia object
import { Inertia } from '@inertiajs/inertia';
// Submit the form using Inertia
Inertia.put('/events/' + eventId, formData).then(() => {
// Reload the current page to fetch the updated data
Inertia.reload();
});
This code assumes that you're using Inertia to submit the form and that you have access to the eventId and formData variables.
If you're having trouble with authentication when making a GET request to fetch the updated data, you can include the authentication token in the request headers. Here's an example of how you can do this using Axios:
// Import the Axios library
import axios from 'axios';
// Make a GET request to fetch the updated data
axios.get('/events/' + eventId, {
headers: {
'Authorization': 'Bearer ' + authToken
}
}).then(response => {
// Update the form data with the fetched data
formData = response.data;
});
This code assumes that you have access to the eventId and authToken variables and that the server returns the updated data in the response body.