From 9a7bb3db01fe2e99ccc12285c63323bc67c278e8 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Mon, 20 Jun 2022 19:50:32 +1000
Subject: Increase type-consistency via server-classes and client-types

---
 src/components/SearchModal.vue | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

(limited to 'src/components/SearchModal.vue')

diff --git a/src/components/SearchModal.vue b/src/components/SearchModal.vue
index 9ea10c8..4ea5cea 100644
--- a/src/components/SearchModal.vue
+++ b/src/components/SearchModal.vue
@@ -3,10 +3,7 @@ import {defineComponent, PropType} from 'vue';
 import SearchIcon from './icon/SearchIcon.vue';
 import InfoIcon from './icon/InfoIcon.vue';
 import {LayoutNode} from '../layout';
-import type {TolMap} from '../tol';
-
-type SearchSugg = {name: string, canonicalName: string | null}; // Represents a search string suggestion
-type SearchSuggResponse = [SearchSugg[], boolean]; // Holds search suggestions and an indication of if there was more
+import type {TolMap, SearchSugg, SearchSuggResponse} from '../lib';
 
 // Displays a search box, and sends search requests
 export default defineComponent({
@@ -107,8 +104,8 @@ export default defineComponent({
 						return response.json()
 					})
 					.then((results: SearchSuggResponse) => {
-						this.searchSuggs = results[0];
-						this.searchHasMoreSuggs = results[1];
+						this.searchSuggs = results.suggs;
+						this.searchHasMoreSuggs = results.hasMore;
 						this.focusedSuggIdx = null;
 					})
 					.catch(error => {
-- 
cgit v1.2.3

