Skip to content

Commit

Permalink
fix add_robot -> add/robot
Browse files Browse the repository at this point in the history
  • Loading branch information
chennisden committed Jun 5, 2024
1 parent e994314 commit 09399e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/src/hooks/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class api {
public async addRobot(robot: Robot): Promise<void> {
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);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Home = () => {
width: "100%",
}}
onClick={() => {
navigate("/add_robot");
navigate("/add/robot");
}}
>
Make a Robot
Expand Down
4 changes: 2 additions & 2 deletions store/app/api/routers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Part(BaseModel):


@api_router.options("/add/robot/")
async def options_add_robot() -> Dict[str, str]:
async def options_add/robot() -> Dict[str, str]:
return {"message": "Options request allowed"}


Expand Down Expand Up @@ -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"}
Expand Down

0 comments on commit 09399e5

Please sign in to comment.