feat: update api
continuous-integration/drone/push Build is passing Details

This commit is contained in:
BryantHe 2023-08-11 17:58:13 +08:00
parent 14a27437a1
commit 5a83cea081
1 changed files with 2 additions and 0 deletions

View File

@ -28,9 +28,11 @@ def login_required(f):
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
token = request.headers.get("Authorization", default=None) token = request.headers.get("Authorization", default=None)
if not token: if not token:
# TODO raise apiflask 的 json 格式的 error
return '请登陆' return '请登陆'
user_id = rpc.admin.identify(token) user_id = rpc.admin.identify(token)
if not user_id: if not user_id:
# TODO raise apiflask 的 json 格式的 error
return '请登陆' return '请登陆'
session['user_id'] = user_id session['user_id'] = user_id
return f(*args, **kwargs) return f(*args, **kwargs)