diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-04-27 00:29:20 +1000 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-04-27 01:38:04 +1000 |
| commit | 6f52cd6b07970010c40270003d63aa74f84f6ae9 (patch) | |
| tree | f23c0a9ebc50db89463621516ab643d5c76c1590 /src | |
| parent | 55e281a57c2ac9acb18836ea7a48f5a553d924e2 (diff) | |
Use EOL vernacular-names data for searching
Add data/eolNamesToSqlite.py to read EOL vernacular-names data and add
to sqlite db. Adjust server.py to handle search requests, and adjust
SearchModal to make them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/SearchModal.vue | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/components/SearchModal.vue b/src/components/SearchModal.vue index f3bb237..cd4bede 100644 --- a/src/components/SearchModal.vue +++ b/src/components/SearchModal.vue @@ -20,17 +20,19 @@ export default defineComponent({ let input = this.$refs.searchInput as HTMLInputElement; // Query server let url = new URL(window.location.href); - url.pathname = '/data/node'; + url.pathname = '/data/search'; url.search = '?name=' + encodeURIComponent(input.value); fetch(url.toString()) - .then(response => { + .then(response => response.json()) + .then(tolNodeName => { // Search successful. Get nodes in parent-chain, add to tolMap, then emit event. url.pathname = '/data/chain'; + url.search = '?name=' + encodeURIComponent(tolNodeName); fetch(url.toString()) .then(response => response.json()) .then(obj => { Object.getOwnPropertyNames(obj).forEach(key => {this.tolMap.set(key, obj[key])}); - this.$emit('search-node', input.value); + this.$emit('search-node', tolNodeName); }) .catch(error => { console.log('ERROR loading tolnode chain', error); |
