rework vehicle handling
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user