Moved configurable api addresses to config.json. Elasticsearch relatime search can also be disabled by setting to false or undefined
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import storage from '@/storage.js'
|
import storage from '@/storage.js'
|
||||||
|
import config from '@/config.json'
|
||||||
|
|
||||||
// const SEASONED_URL = 'https://api.kevinmidboe.com/api/'
|
const SEASONED_URL = config.SEASONED_URL
|
||||||
const SEASONED_URL = 'http://localhost:31459/api/'
|
const ELASTIC_URL = config.ELASTIC_URL
|
||||||
|
|
||||||
const ELASTIC_URL = 'http://localhost:9200/'
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// - Move autorization token and errors here?
|
// - Move autorization token and errors here?
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<transition name="fade">
|
<transition name="fade">
|
||||||
<div class="dropdown" v-if="focus && query.length > 0">
|
<div class="dropdown" v-if="!disabled && focus && query.length > 0">
|
||||||
<div class="dropdown--results">
|
<div class="dropdown--results">
|
||||||
|
|
||||||
<ul v-for="(item, index) in elasticSearchResults"
|
<ul v-for="(item, index) in elasticSearchResults"
|
||||||
@@ -46,6 +46,7 @@
|
|||||||
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
||||||
|
|
||||||
import { elasticSearchMoviesAndShows } from '@/api.js'
|
import { elasticSearchMoviesAndShows } from '@/api.js'
|
||||||
|
import config from '@/config.json'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SearchInput',
|
name: 'SearchInput',
|
||||||
@@ -57,6 +58,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
query: this.value,
|
query: this.value,
|
||||||
focus: false,
|
focus: false,
|
||||||
|
disabled: false,
|
||||||
scrollListener: undefined,
|
scrollListener: undefined,
|
||||||
scrollDistance: 0,
|
scrollDistance: 0,
|
||||||
elasticSearchResults: '',
|
elasticSearchResults: '',
|
||||||
@@ -73,6 +75,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeMount() {
|
||||||
|
const elasticUrl = config.ELASTIC_URL
|
||||||
|
if (elasticUrl === undefined || elasticUrl === false || elasticUrl === '') {
|
||||||
|
this.disabled = true
|
||||||
|
}
|
||||||
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
console.log('scroll eventlistener not removed, destroying!')
|
console.log('scroll eventlistener not removed, destroying!')
|
||||||
window.removeEventListener('scroll', this.disableFocus)
|
window.removeEventListener('scroll', this.disableFocus)
|
||||||
|
|||||||
4
src/config.json
Normal file
4
src/config.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"SEASONED_URL": "http://localhost:31459/api",
|
||||||
|
"ELASTIC_URL": "http://localhost:9200"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user