From d4b3135cca3ef7643a9a33e8ed1921d6e54eb9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Luna=20Hern=C3=A1ndez?= <42101656@uaz.edu.mx> Date: Thu, 14 Nov 2024 22:42:07 -0600 Subject: [PATCH] Se conecta la funcion de eliminar con el back --- web/src/data/datasource/api/place_datasource.ts | 2 +- .../admin_panel_place_list/admin_panel_place_list.tsx | 8 ++++++-- .../admin_panel_place_screen/admin_panel_place_screen.tsx | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/web/src/data/datasource/api/place_datasource.ts b/web/src/data/datasource/api/place_datasource.ts index 946b8bb5..ad78f7e2 100644 --- a/web/src/data/datasource/api/place_datasource.ts +++ b/web/src/data/datasource/api/place_datasource.ts @@ -132,6 +132,6 @@ export class PlaceDatasourceProd implements PlaceDatasourceInf { * @returns A promise that resolves when the place is deleted. */ async deletePlace(idPlace: number): Promise { - //await axios.patch(APIUrl + `/place/${idPlace}`) + await axios.delete(APIUrl + `/place/${idPlace}`) } } diff --git a/web/src/presentation/admin/admin_panel_places/admin_panel_place_list/admin_panel_place_list.tsx b/web/src/presentation/admin/admin_panel_places/admin_panel_place_list/admin_panel_place_list.tsx index 468d0809..8cbd47e7 100644 --- a/web/src/presentation/admin/admin_panel_places/admin_panel_place_list/admin_panel_place_list.tsx +++ b/web/src/presentation/admin/admin_panel_places/admin_panel_place_list/admin_panel_place_list.tsx @@ -18,6 +18,7 @@ interface props { setIsWindowActiveDelete: Dispatch>; setActualPlace: Dispatch>; setIsRegisterPane: Dispatch>; + forceRenderList: () => void; } // Define the AdminPanelPlaceList component @@ -28,9 +29,11 @@ export const AdminPanelPlaceList = ({ setActualPlace, setIsRegisterPane, setIsWindowActiveDelete, + forceRenderList, }: props) => { // Use the custom hook to fetch place data - const { placeList, pending, updatePlacesByTown, deletePlace } = usePlace(); + const { placeList, pending, updatePlacesByTown, deletePlace } = + usePlace(forceRenderList); // State variables for managing dialog and deletion const [isDialogOpen, setIsDialogOpen] = useState(false); @@ -113,7 +116,8 @@ export const AdminPanelPlaceList = ({ } }} /> - {/* Separation between icons */} + {" "} + {/* Separation between icons */} -- GitLab