From 8e060722048a6e35aca728e794a9db84fc6c1892 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 9 Apr 2020 16:38:26 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 1 + ayanova/src/views/home-search.vue | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 5eeafa2e..7151e9f9 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -52,6 +52,7 @@ CURRENT TODOs todo: excerpt, add as part of item object and conditionally show todo: search controller at server needs an excerpt route so client can request an excerpt for a record +todo: add integration test for search controller get excerpt route todo: session cache search results and scroll position if possible to support "back and forthing" todo: search what order should the results be retruned in, right now is by id but looks weird in list todo: look at using finally block in all fetch form calls to do the things that are repeated in catch and then above it see search form for example diff --git a/ayanova/src/views/home-search.vue b/ayanova/src/views/home-search.vue index bb16af99..d4829d59 100644 --- a/ayanova/src/views/home-search.vue +++ b/ayanova/src/views/home-search.vue @@ -168,10 +168,33 @@ export default { }); }, getExcerpt(item) { + let vm = this; + //Search/Info/2/1?phrase=we if (item.info) { return; } - // item.info = "***NEW INFO HERE****"; + + window.$gz.api + .get( + API_BASE_URL + + item.type + + "/" + + item.id + + "?phrase=" + + vm.searchPhrase + ) + + .then(res => { + if (res.error != undefined) { + vm.formState.serverError = res.error; + window.$gz.form.setErrorBoxErrors(vm); + } else { + item.info = res.data; + } + }) + .catch(function handleGetDataFromAPIError(error) { + window.$gz.errorHandler.handleFormError(error, vm); + }); }, getDataFromApi() { let vm = this;