rework vehicle handling
This commit is contained in:
@@ -216,6 +216,9 @@ export const incidentsApi = {
|
||||
const response = await api.get<{ success: boolean; data: IncidentListResponse }>(
|
||||
`/api/incidents?${params.toString()}`
|
||||
);
|
||||
if (!response.data?.data) {
|
||||
throw new Error('Invalid API response');
|
||||
}
|
||||
return response.data.data;
|
||||
},
|
||||
|
||||
@@ -227,6 +230,9 @@ export const incidentsApi = {
|
||||
const response = await api.get<{ success: boolean; data: EinsatzStats }>(
|
||||
`/api/incidents/stats${params}`
|
||||
);
|
||||
if (!response.data?.data) {
|
||||
throw new Error('Invalid API response');
|
||||
}
|
||||
return response.data.data;
|
||||
},
|
||||
|
||||
@@ -237,6 +243,9 @@ export const incidentsApi = {
|
||||
const response = await api.get<{ success: boolean; data: EinsatzDetail }>(
|
||||
`/api/incidents/${id}`
|
||||
);
|
||||
if (!response.data?.data) {
|
||||
throw new Error('Invalid API response');
|
||||
}
|
||||
return response.data.data;
|
||||
},
|
||||
|
||||
@@ -248,6 +257,9 @@ export const incidentsApi = {
|
||||
'/api/incidents',
|
||||
payload
|
||||
);
|
||||
if (!response.data?.data) {
|
||||
throw new Error('Invalid API response');
|
||||
}
|
||||
return response.data.data;
|
||||
},
|
||||
|
||||
@@ -259,6 +271,9 @@ export const incidentsApi = {
|
||||
`/api/incidents/${id}`,
|
||||
payload
|
||||
);
|
||||
if (!response.data?.data) {
|
||||
throw new Error('Invalid API response');
|
||||
}
|
||||
return response.data.data;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user