Fix: JSON parsing error on session expiry and enhance API error handling

This commit is contained in:
leeyj
2026-04-18 00:49:53 +09:00
parent 8d96cc2e83
commit 4202f38e58
4 changed files with 122 additions and 82 deletions
+2
View File
@@ -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