feat(phase2): add admin photo replacement button with ItemDetailModal
- Add ItemDetailModal component for viewing item details and replacing photos
- Add photo replacement/deletion endpoints to API layer (PUT/DELETE /items/{id}/photo)
- Update InventoryTable to open detail modal on item click
- Show current photo thumbnail with Replace/Delete buttons
- Support uploading new photo with ItemPhotoUpload component
- Delete old photo on backend when replacing (no orphaned files)
- Full test coverage: 18 tests for ItemDetailModal component
- All 393 tests passing, zero TypeScript errors
- Build verified successfully
This commit is contained in:
@@ -272,4 +272,18 @@ export const inventoryApi = {
|
||||
});
|
||||
return res.data;
|
||||
},
|
||||
|
||||
// Photo Replacement
|
||||
replaceItemPhoto: async (itemId: number, formData: FormData) => {
|
||||
const res = await axiosInstance.put(`/items/${itemId}/photo`, formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
});
|
||||
return res.data;
|
||||
},
|
||||
|
||||
// Photo Deletion
|
||||
deleteItemPhoto: async (itemId: number) => {
|
||||
const res = await axiosInstance.delete(`/items/${itemId}/photo`);
|
||||
return res.data;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user