feat: 首页拆分独立加载、骨架动画和手动刷新
This commit is contained in:
@@ -20,6 +20,9 @@ from euniv.models import Account
|
||||
from euniv.service import (
|
||||
fetch_exam_detail,
|
||||
fetch_home,
|
||||
fetch_home_exams,
|
||||
fetch_home_summary,
|
||||
fetch_home_trainings,
|
||||
fetch_training_detail,
|
||||
login_and_store,
|
||||
revoke_credential,
|
||||
@@ -151,6 +154,30 @@ def home(request: Request, db: Session = Depends(get_db)) -> dict:
|
||||
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@app.get("/api/home/summary")
|
||||
def home_summary(request: Request, db: Session = Depends(get_db)) -> dict:
|
||||
try:
|
||||
return fetch_home_summary(db, _signed_in(request, db))
|
||||
except RuntimeError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@app.get("/api/home/exams")
|
||||
def home_exams(request: Request, db: Session = Depends(get_db)) -> dict:
|
||||
try:
|
||||
return fetch_home_exams(db, _signed_in(request, db))
|
||||
except RuntimeError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@app.get("/api/home/trainings")
|
||||
def home_trainings(request: Request, db: Session = Depends(get_db)) -> dict:
|
||||
try:
|
||||
return fetch_home_trainings(db, _signed_in(request, db))
|
||||
except RuntimeError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@app.get("/api/exam")
|
||||
def exam_detail(path: str, request: Request, db: Session = Depends(get_db)) -> dict:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user