Photos for vehicles

This commit is contained in:
Eric Gullickson
2025-12-15 21:39:51 -06:00
parent e1c48b7a26
commit 263fc434b0
17 changed files with 745 additions and 58 deletions

View File

@@ -61,5 +61,22 @@ export const vehiclesApi = {
getTrims: async (year: number, make: string, model: string): Promise<string[]> => {
const response = await apiClient.get(`/vehicles/dropdown/trims?year=${year}&make=${encodeURIComponent(make)}&model=${encodeURIComponent(model)}`);
return response.data;
},
uploadImage: async (vehicleId: string, file: File): Promise<Vehicle> => {
const formData = new FormData();
formData.append('file', file);
const response = await apiClient.post(`/vehicles/${vehicleId}/image`, formData, {
headers: { 'Content-Type': 'multipart/form-data' }
});
return response.data;
},
deleteImage: async (vehicleId: string): Promise<void> => {
await apiClient.delete(`/vehicles/${vehicleId}/image`);
},
getImageUrl: (vehicleId: string): string => {
return `/api/vehicles/${vehicleId}/image`;
}
};