forked from beimingwu/beimingwu
[FIX] Fix bug in api/user.py
This commit is contained in:
parent
ad4da46cef
commit
ddef9a876c
18
api/user.py
18
api/user.py
|
@ -14,6 +14,15 @@ def index():
|
|||
return f"User API Index {C.stats}"
|
||||
|
||||
|
||||
@user_api.before_app_request
|
||||
def load_logged_in_user():
|
||||
user_id = session.get('user_id')
|
||||
if user_id is None:
|
||||
g.user = None
|
||||
else:
|
||||
g.user = get_user_info(by='id', value=user_id)
|
||||
|
||||
|
||||
@user_api.route('/register', methods=['POST'])
|
||||
def register():
|
||||
if request.method == 'POST':
|
||||
|
@ -59,15 +68,6 @@ def login():
|
|||
return jsonify(result)
|
||||
|
||||
|
||||
@user_api.before_app_request
|
||||
def load_logged_in_user():
|
||||
user_id = session.get('user_id')
|
||||
if user_id is None:
|
||||
g.user = None
|
||||
else:
|
||||
g.user = get_user_info(by='id', value=user_id)
|
||||
|
||||
|
||||
@user_api.route('/logout', methods=['POST'])
|
||||
def logout():
|
||||
if g.user is None:
|
||||
|
|
Loading…
Reference in New Issue