mirror of
https://github.com/sotam0316/brain_dogfood.git
synced 2026-04-25 03:48:38 +09:00
Fix: JSON parsing error on session expiry and enhance API error handling
This commit is contained in:
@@ -16,6 +16,8 @@ def login_required(view):
|
||||
def wrapped_view(**kwargs):
|
||||
# app/routes/auth.py의 세션 키와 일치시킴 (logged_in)
|
||||
if session.get('logged_in') is None:
|
||||
if request.path.startswith('/api/'):
|
||||
return jsonify({'error': 'Unauthorized', 'message': 'Session expired or not logged in'}), 401
|
||||
return redirect(url_for('main.login_page'))
|
||||
return view(**kwargs)
|
||||
return wrapped_view
|
||||
|
||||
Reference in New Issue
Block a user