mirror of
https://github.com/fergalmoran/turnstone.git
synced 2025-12-22 09:49:56 +00:00
Move test API host to env. Add plugin as import.
This commit is contained in:
@@ -9,9 +9,11 @@ import ItemContents from './components/itemContents/itemContents'
|
|||||||
import GroupName from './components/groupName/groupName'
|
import GroupName from './components/groupName/groupName'
|
||||||
import CancelButton from './components/cancelButton/cancelButton'
|
import CancelButton from './components/cancelButton/cancelButton'
|
||||||
import ClearButton from './components/clearButton/clearButton'
|
import ClearButton from './components/clearButton/clearButton'
|
||||||
import recentSearchesPlugin from '../../plugins/turnstone-recent-searches'
|
import recentSearchesPlugin from 'turnstone-recent-searches'
|
||||||
import undef from '../../src/lib/utils/undef'
|
import undef from '../../src/lib/utils/undef'
|
||||||
|
|
||||||
|
const apiHost = import.meta.env.VITE_API_HOST
|
||||||
|
console.log({apiHost})
|
||||||
const maxItems = 10
|
const maxItems = 10
|
||||||
const placeholder = 'Enter a city or airport'
|
const placeholder = 'Enter a city or airport'
|
||||||
const noItemsMessage = 'We found no places that match your search'
|
const noItemsMessage = 'We found no places that match your search'
|
||||||
@@ -23,7 +25,7 @@ const listbox = [
|
|||||||
ratio: 8,
|
ratio: 8,
|
||||||
displayField: 'name',
|
displayField: 'name',
|
||||||
data: (query) =>
|
data: (query) =>
|
||||||
fetch(`http://localhost:3001/api/search/cities?q=${encodeURIComponent(query)}&limit=${maxItems}`)
|
fetch(`${apiHost}/api/search/cities?q=${encodeURIComponent(query)}&limit=${maxItems}`)
|
||||||
.then(response => response.json()),
|
.then(response => response.json()),
|
||||||
searchType: 'startswith'
|
searchType: 'startswith'
|
||||||
},
|
},
|
||||||
@@ -33,7 +35,7 @@ const listbox = [
|
|||||||
ratio: 2,
|
ratio: 2,
|
||||||
displayField: 'name',
|
displayField: 'name',
|
||||||
data: (query) =>
|
data: (query) =>
|
||||||
fetch(`http://localhost:3001/api/search/airports?q=${encodeURIComponent(query)}&limit=${maxItems}`)
|
fetch(`${apiHost}/api/search/airports?q=${encodeURIComponent(query)}&limit=${maxItems}`)
|
||||||
.then(response => response.json()),
|
.then(response => response.json()),
|
||||||
searchType: 'contains'
|
searchType: 'contains'
|
||||||
}
|
}
|
||||||
|
|||||||
15
package-lock.json
generated
15
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "turnstone",
|
"name": "turnstone",
|
||||||
"version": "1.2.0",
|
"version": "1.2.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "turnstone",
|
"name": "turnstone",
|
||||||
"version": "1.2.0",
|
"version": "1.2.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"escape-string-regexp": "^5.0.0",
|
"escape-string-regexp": "^5.0.0",
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
"setify": "^1.0.4",
|
"setify": "^1.0.4",
|
||||||
"split-match": "^0.2.2",
|
"split-match": "^0.2.2",
|
||||||
"swr": "^1.1.2",
|
"swr": "^1.1.2",
|
||||||
|
"turnstone-recent-searches": "^0.4.0",
|
||||||
"use-debounce": "^7.0.1"
|
"use-debounce": "^7.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -5006,6 +5007,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||||
},
|
},
|
||||||
|
"node_modules/turnstone-recent-searches": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/turnstone-recent-searches/-/turnstone-recent-searches-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-3/ejeRHv+awlU2mI6l3dFXmbvzCsi0KgEmbJ7AD/X50d0Eu7VbJXnoH5RsMU4rFuO6swPGMhsuTx5Dl48MyBLw=="
|
||||||
|
},
|
||||||
"node_modules/type-check": {
|
"node_modules/type-check": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
||||||
@@ -9054,6 +9060,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||||
},
|
},
|
||||||
|
"turnstone-recent-searches": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/turnstone-recent-searches/-/turnstone-recent-searches-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-3/ejeRHv+awlU2mI6l3dFXmbvzCsi0KgEmbJ7AD/X50d0Eu7VbJXnoH5RsMU4rFuO6swPGMhsuTx5Dl48MyBLw=="
|
||||||
|
},
|
||||||
"type-check": {
|
"type-check": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
"setify": "^1.0.4",
|
"setify": "^1.0.4",
|
||||||
"split-match": "^0.2.2",
|
"split-match": "^0.2.2",
|
||||||
"swr": "^1.1.2",
|
"swr": "^1.1.2",
|
||||||
|
"turnstone-recent-searches": "^0.4.0",
|
||||||
"use-debounce": "^7.0.1"
|
"use-debounce": "^7.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user