From 59ed51e14f354bfa7b23aa8d6697f2b91071e04c Mon Sep 17 00:00:00 2001 From: RemixDev Date: Thu, 14 May 2020 19:15:47 +0200 Subject: [PATCH] Added blank search result check on backend --- server.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index c6c7bbf..858c44d 100644 --- a/server.py +++ b/server.py @@ -130,14 +130,16 @@ def logout(): @socketio.on('mainSearch') def mainSearch(data): - emit('mainSearch', app.mainSearch(session['dz'], data['term'])) + if data['term'].strip() != "": + emit('mainSearch', app.mainSearch(session['dz'], data['term'])) @socketio.on('search') def search(data): - result = app.search(session['dz'], data['term'], data['type'], data['start'], data['nb']) - result['type'] = data['type'] - emit('search', result) + if data['term'].strip() != "": + result = app.search(session['dz'], data['term'], data['type'], data['start'], data['nb']) + result['type'] = data['type'] + emit('search', result) @socketio.on('addToQueue')