Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/fulltextsearch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'js/fulltextsearch.v1.api.js')
-rw-r--r--js/fulltextsearch.v1.api.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/js/fulltextsearch.v1.api.js b/js/fulltextsearch.v1.api.js
index 778ae10..394bf4c 100644
--- a/js/fulltextsearch.v1.api.js
+++ b/js/fulltextsearch.v1.api.js
@@ -34,8 +34,8 @@
var api = {
- search: function (request, callback) {
- var res = {status: -1};
+ search: function (request, callback, callbackError) {
+ var res = {status: -1, error: 'failed to connect to Nextcloud'};
nav.onSearchRequest(request);
@@ -46,12 +46,19 @@ var api = {
request: JSON.stringify(request)
}
}).done(function (res) {
+ if (_.has(res, 'error')) {
+ result.displayError(res);
+ nav.onError(res.error);
+ api.onCallback(callbackError, res);
+ return;
+ }
result.displayResult(res);
nav.onResultDisplayed(res);
api.onCallback(callback, res);
}).fail(function () {
- nav.failedToAjax();
- api.onCallback(callback, res);
+ nav.failedToAjax(res);
+ nav.onError(res.error);
+ api.onCallback(callbackError, res);
});
},