refactor(api): use Annotated-style dependency injection
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.dependencies.fetcher import get_fetcher
|
||||
from app.fetcher import Fetcher
|
||||
from app.dependencies.fetcher import Fetcher
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from fastapi import APIRouter
|
||||
|
||||
fetcher_router = APIRouter(prefix="/fetcher", include_in_schema=False)
|
||||
|
||||
|
||||
@fetcher_router.get("/callback")
|
||||
async def callback(code: str, fetcher: Fetcher = Depends(get_fetcher)):
|
||||
async def callback(code: str, fetcher: Fetcher):
|
||||
await fetcher.grant_access_token(code)
|
||||
return {"message": "Login successful"}
|
||||
|
||||
Reference in New Issue
Block a user