mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-30 18:09:40 +05:00
front & back: getting ready for user auth
This commit is contained in:
parent
732799703d
commit
17b5693f34
4 changed files with 91 additions and 14 deletions
|
@ -2,13 +2,18 @@ from fastapi import APIRouter
|
|||
from fastapi import Request
|
||||
from modules.proxy import apiRequest
|
||||
from modules.proxy import ENDPOINTS
|
||||
from typing import Union
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/{user_id}", summary="Get user profile by user ID")
|
||||
async def getUserById(request: Request, user_id: str, short: bool = False):
|
||||
res = await apiRequest(request, ENDPOINTS["profile"], user_id)
|
||||
async def getUserById(request: Request, user_id: str, short: bool = False, token: Union[None, str] = None):
|
||||
query = ""
|
||||
if token:
|
||||
query = f"?token={token}"
|
||||
|
||||
res = await apiRequest(request, ENDPOINTS["profile"], user_id, query=query)
|
||||
if short is False:
|
||||
return res
|
||||
return {
|
||||
|
@ -18,4 +23,5 @@ async def getUserById(request: Request, user_id: str, short: bool = False):
|
|||
"login": res["profile"]["login"],
|
||||
"avatar": res["profile"]["avatar"],
|
||||
},
|
||||
"is_my_profile": res["is_my_profile"]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue