From c35f520dc64420ec1eb47ed22bdcea95278083bd Mon Sep 17 00:00:00 2001 From: Dennis Chen Date: Wed, 5 Jun 2024 13:27:22 -0700 Subject: [PATCH] fix add_robot -> add/robot --- frontend/src/hooks/api.tsx | 2 +- frontend/src/pages/Home.tsx | 2 +- store/app/api/routers/main.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/hooks/api.tsx b/frontend/src/hooks/api.tsx index e5019045..510406c3 100644 --- a/frontend/src/hooks/api.tsx +++ b/frontend/src/hooks/api.tsx @@ -102,7 +102,7 @@ class api { public async addRobot(robot: Robot): Promise { const s = robot.name; try { - await this.api.post("/add_robot/", robot); + await this.api.post("/add/robot/", robot); } catch (error) { if (axios.isAxiosError(error)) { console.error("Error adding robot:", error.response?.data); diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index 2b8dfa59..ebd47b67 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -40,7 +40,7 @@ const Home = () => { width: "100%", }} onClick={() => { - navigate("/add_robot"); + navigate("/add/robot"); }} > Make a Robot diff --git a/store/app/api/routers/main.py b/store/app/api/routers/main.py index aedc199d..04a57f8f 100644 --- a/store/app/api/routers/main.py +++ b/store/app/api/routers/main.py @@ -147,7 +147,7 @@ async def list_parts(crud: Annotated[Crud, Depends(Crud.get)]) -> List[Part]: @api_router.post("/add/robot/") -async def add_robot(robot: Robot, crud: Annotated[Crud, Depends(Crud.get)]) -> Dict[str, str]: +async def add/robot(robot: Robot, crud: Annotated[Crud, Depends(Crud.get)]) -> Dict[str, str]: table = await crud.db.Table("Robots") await table.put_item(Item=robot.model_dump()) return {"message": "Robot added successfully"}