Skip to content

Commit

Permalink
PB-227: Fix serialization error after updating flask
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasJoss committed Sep 6, 2024
1 parent 31fed3a commit ddfeb0a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ def make_api_compliant_response(response_object):
"""
if isinstance(response_object, (Icon, IconSet)):
return make_response(jsonify({'success': True, **response_object.serialize()}))
if all(isinstance(r, (Icon, IconSet)) for r in response_object):
return make_response(
jsonify({
'success': True, "items": [r.serialize() for r in response_object]
})
)
if isinstance(response_object, list):
return make_response(jsonify({'success': True, "items": response_object}))
return make_response(jsonify({'success': True, **response_object}))
Expand Down

0 comments on commit ddfeb0a

Please sign in to comment.