Update code in endpoints/logout.post.py
This commit is contained in:
parent
51ee847717
commit
0e1485d316
23
endpoints/logout.post.py
Normal file
23
endpoints/logout.post.py
Normal file
@ -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]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user