Why does the terminal say PATCH but no change in database
in my webpage, i update the request details to approve or reject. but it does not change in the status and still shows pending
. the problem is, in my terminal it says PATCH so I though that means change and the database has been changed. but when I run my SQL shell, it still shows pending
.
what would the problem be? this is my handlestatusupdate code in the frontend: **const handleStatusUpdate = async (newStatus: 'approved' | 'rejected') => { if (!selectedRequest?.id) return;
try {
const response = await fetch(`${API_URL}/requests/${selectedRequest.id}/`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ status: newStatus }),
});
if (!response.ok) {
throw new Error('Failed to update request status');
}
const updatedRequest = await response.json();
setRequests(requests.map(req =>
req.id === selectedRequest.id ? updatedRequest : req
));
setShowModal(false);
} catch (err: any) {
setError(err.message || 'Failed to update status');
}
}; **
what other code would i need to share? the backend?