rework vehicle handling

This commit is contained in:
Matthias Hochmeister
2026-02-28 14:13:56 +01:00
parent 06f94a6a48
commit b7b883649c
7 changed files with 38 additions and 27 deletions

View File

@@ -216,7 +216,7 @@ export const incidentsApi = {
const response = await api.get<{ success: boolean; data: IncidentListResponse }>(
`/api/incidents?${params.toString()}`
);
if (!response.data?.data) {
if (response.data?.data === undefined || response.data?.data === null) {
throw new Error('Invalid API response');
}
return response.data.data;
@@ -230,7 +230,7 @@ export const incidentsApi = {
const response = await api.get<{ success: boolean; data: EinsatzStats }>(
`/api/incidents/stats${params}`
);
if (!response.data?.data) {
if (response.data?.data === undefined || response.data?.data === null) {
throw new Error('Invalid API response');
}
return response.data.data;
@@ -243,7 +243,7 @@ export const incidentsApi = {
const response = await api.get<{ success: boolean; data: EinsatzDetail }>(
`/api/incidents/${id}`
);
if (!response.data?.data) {
if (response.data?.data === undefined || response.data?.data === null) {
throw new Error('Invalid API response');
}
return response.data.data;
@@ -257,7 +257,7 @@ export const incidentsApi = {
'/api/incidents',
payload
);
if (!response.data?.data) {
if (response.data?.data === undefined || response.data?.data === null) {
throw new Error('Invalid API response');
}
return response.data.data;
@@ -271,7 +271,7 @@ export const incidentsApi = {
`/api/incidents/${id}`,
payload
);
if (!response.data?.data) {
if (response.data?.data === undefined || response.data?.data === null) {
throw new Error('Invalid API response');
}
return response.data.data;