Merge branch 'api-return-on-empty-search' into 'master'

Always return a list when searching in the API

Closes web-remote#1

See merge request openlp/openlp!156
This commit is contained in:
Tim Bentley 2020-03-14 17:00:09 +00:00
commit 4a667c77fc
6 changed files with 6 additions and 18 deletions

View File

@ -61,9 +61,7 @@ def add(id):
def search_bible(): def search_bible():
text = request.args.get('text', '') text = request.args.get('text', '')
result = search(text) result = search(text)
if result: return jsonify(result)
return jsonify(result)
return '', 400
@v2_views.route('/live', methods=['POST']) @v2_views.route('/live', methods=['POST'])

View File

@ -61,9 +61,7 @@ def add(id):
def search_view(): def search_view():
text = request.args.get('text', '') text = request.args.get('text', '')
result = search(text) result = search(text)
if result: return jsonify(result)
return jsonify(result)
return '', 400
@v2_custom.route('/add', methods=['POST']) @v2_custom.route('/add', methods=['POST'])

View File

@ -61,9 +61,7 @@ def add(id):
def search_view(): def search_view():
text = request.args.get('text', '') text = request.args.get('text', '')
result = search(text) result = search(text)
if result: return jsonify(result)
return jsonify(result)
return '', 400
@v2_images.route('/add', methods=['POST']) @v2_images.route('/add', methods=['POST'])

View File

@ -61,9 +61,7 @@ def add(id):
def search_view(): def search_view():
text = request.args.get('text', '') text = request.args.get('text', '')
result = search(text) result = search(text)
if result: return jsonify(result)
return jsonify(result)
return '', 400
@v2_media.route('/add', methods=['POST']) @v2_media.route('/add', methods=['POST'])

View File

@ -61,9 +61,7 @@ def add(id):
def search_view(): def search_view():
text = request.args.get('text', '') text = request.args.get('text', '')
result = search(text) result = search(text)
if result: return jsonify(result)
return jsonify(result)
return '', 400
@v2_presentations.route('/add', methods=['POST']) @v2_presentations.route('/add', methods=['POST'])

View File

@ -61,9 +61,7 @@ def add(id):
def search_view(): def search_view():
text = request.args.get('text', '') text = request.args.get('text', '')
result = search(text) result = search(text)
if result: return jsonify(result)
return jsonify(result)
return '', 400
@v2_songs.route('/add', methods=['POST']) @v2_songs.route('/add', methods=['POST'])