Fixed api send on ticket resolution
This commit is contained in:
@@ -404,9 +404,15 @@ function updateTicketStatus() {
|
|||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
return response.text().then(text => {
|
return response.json().then(data => {
|
||||||
console.error('Server response:', text);
|
console.error('Server error response:', data);
|
||||||
throw new Error('Network response was not ok');
|
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();
|
return response.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user