From 0e1485d316f2162217db5d4ff7d042f2d08b8a5c Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Sun, 23 Mar 2025 17:28:36 +0100 Subject: [PATCH] Update code in endpoints/logout.post.py --- endpoints/logout.post.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 endpoints/logout.post.py diff --git a/endpoints/logout.post.py b/endpoints/logout.post.py new file mode 100644 index 0000000..2232982 --- /dev/null +++ b/endpoints/logout.post.py @@ -0,0 +1,23 @@ +from fastapi import APIRouter, HTTPException + +laptops = [ + {"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") +async def logout(): + """Returns list of laptop names""" + if request.method != "POST": + raise HTTPException(status_code=405, detail="Method Not Allowed") + + return { + "method": "POST", + "_verb": "post", + "data": [laptop["name"] for laptop in laptops] + } \ No newline at end of file