diff --git a/endpoints/logout.post.py b/endpoints/logout.post.py index ae67185..c447b0a 100644 --- a/endpoints/logout.post.py +++ b/endpoints/logout.post.py @@ -1,26 +1,25 @@ from fastapi import APIRouter, HTTPException laptops = [ - {"name": "MacBook Pro"}, - {"name": "Dell XPS"}, - {"name": "Lenovo ThinkPad"}, - {"name": "HP Spectre"} + {"name": "Dell XPS 13"}, + {"name": "MacBook Pro 16"}, + {"name": "Lenovo ThinkPad X1 Carbon"}, + {"name": "HP Spectre x360"}, + {"name": "Asus ZenBook Pro Duo"} ] router = APIRouter() -@router.post("/logout") +@router.post("/logout", response_model=list) async def logout(): - """endpoints that returns list of laptops names""" + """Returns list of laptop names""" if request.method != "POST": - raise HTTPException(status_code=405, detail={ - "message": "Method Not Allowed", - "method": "POST", - "_verb": "post" - }) - + raise HTTPException(status_code=405, detail="Method Not Allowed") + + laptop_names = [laptop["name"] for laptop in laptops] + return { "method": "POST", "_verb": "post", - "laptops": [laptop["name"] for laptop in laptops] + "data": laptop_names } \ No newline at end of file