update
This commit is contained in:
@@ -50,9 +50,9 @@ export const bookingApi = {
|
||||
fahrzeugId: string,
|
||||
from: Date,
|
||||
to: Date
|
||||
): Promise<{ available: boolean }> {
|
||||
): Promise<{ available: boolean; reason?: string; ausserDienstVon?: string; ausserDienstBis?: string }> {
|
||||
return api
|
||||
.get<ApiResponse<{ available: boolean }>>('/api/bookings/availability', {
|
||||
.get<ApiResponse<{ available: boolean; reason?: string; ausserDienstVon?: string; ausserDienstBis?: string }>>('/api/bookings/availability', {
|
||||
params: {
|
||||
fahrzeugId,
|
||||
from: from.toISOString(),
|
||||
|
||||
@@ -9,6 +9,7 @@ import type {
|
||||
UpdateFahrzeugPayload,
|
||||
UpdateStatusPayload,
|
||||
CreateWartungslogPayload,
|
||||
StatusUpdateResponse,
|
||||
} from '../types/vehicle.types';
|
||||
|
||||
async function unwrap<T>(
|
||||
@@ -68,8 +69,12 @@ export const vehiclesApi = {
|
||||
await api.delete(`/api/vehicles/${id}`);
|
||||
},
|
||||
|
||||
async updateStatus(id: string, payload: UpdateStatusPayload): Promise<void> {
|
||||
await api.patch(`/api/vehicles/${id}/status`, payload);
|
||||
async updateStatus(id: string, payload: UpdateStatusPayload): Promise<StatusUpdateResponse> {
|
||||
const response = await api.patch<{ success: boolean; data: StatusUpdateResponse }>(
|
||||
`/api/vehicles/${id}/status`,
|
||||
payload
|
||||
);
|
||||
return response.data?.data ?? { overlappingBookings: [] };
|
||||
},
|
||||
|
||||
async getWartungslog(id: string): Promise<FahrzeugWartungslog[]> {
|
||||
|
||||
Reference in New Issue
Block a user