Fixed api send on ticket resolution
This commit is contained in:
@@ -404,9 +404,15 @@ function updateTicketStatus() {
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
return response.text().then(text => {
|
||||
console.error('Server response:', text);
|
||||
throw new Error('Network response was not ok');
|
||||
return response.json().then(data => {
|
||||
console.error('Server error response:', data);
|
||||
throw new Error(data.error || 'Server returned an error');
|
||||
}).catch(jsonError => {
|
||||
// If JSON parsing fails, try to get text
|
||||
return response.text().then(text => {
|
||||
console.error('Server response (non-JSON):', text);
|
||||
throw new Error(text || 'Network response was not ok');
|
||||
});
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
|
||||
Reference in New Issue
Block a user