fix: ClosedCases — apiFetch возвращает Response, а не JSON (архив всегда показывал 0)
- Загрузка списка, создание и удаление переведены на apiJson (apiFetch → Response.items === undefined → items=[]).
This commit is contained in:
@@ -138,9 +138,8 @@ export default function ClosedCases() {
|
||||
}
|
||||
setSaving(true);
|
||||
try {
|
||||
const created = await apiFetch('/api/v1/closed-cases', {
|
||||
const created = await apiJson('/api/v1/closed-cases', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(CleanForm(form)),
|
||||
});
|
||||
setLastPrediction(created);
|
||||
@@ -156,7 +155,7 @@ export default function ClosedCases() {
|
||||
const remove = async (id) => {
|
||||
if (!window.confirm('Удалить запись?')) return;
|
||||
try {
|
||||
await apiFetch(`/api/v1/closed-cases/${id}`, { method: 'DELETE' });
|
||||
await apiJson(`/api/v1/closed-cases/${id}`, { method: 'DELETE' });
|
||||
await load();
|
||||
} catch (e) {
|
||||
setError(e.message);
|
||||
|
||||
Reference in New Issue
Block a user