From 58f47b7a67dec82f34e943f8fcbac168940e3b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karlo=20Miku=C5=A1?= Date: Sun, 15 Dec 2024 14:20:34 +0100 Subject: [PATCH] Fetch host from local storage --- src/components/Cocktail/CocktailForm.vue | 4 ++-- src/components/Cocktail/CocktailImport.vue | 2 +- src/components/Cocktail/CocktailIndex.vue | 4 ++-- src/components/Cocktail/IngredientModal.vue | 3 +-- src/components/Cocktail/SubstituteModal.vue | 6 +----- src/components/Ingredient/IngredientForm.vue | 4 ++-- src/components/IngredientFinder.vue | 9 ++++----- src/components/Search/FilterIngredientsModal.vue | 6 +----- 8 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/components/Cocktail/CocktailForm.vue b/src/components/Cocktail/CocktailForm.vue index 3222bd67..f21076ee 100644 --- a/src/components/Cocktail/CocktailForm.vue +++ b/src/components/Cocktail/CocktailForm.vue @@ -72,7 +72,7 @@ @@ -82,7 +82,7 @@

{{ $t('media') }}

diff --git a/src/components/Cocktail/CocktailImport.vue b/src/components/Cocktail/CocktailImport.vue index 9ead677c..2b4bee10 100644 --- a/src/components/Cocktail/CocktailImport.vue +++ b/src/components/Cocktail/CocktailImport.vue @@ -630,7 +630,7 @@ async function getBar(barId: number): Promise {
@@ -31,7 +31,7 @@ {{ $t('search.ignore-ingredients') }} ({{ activeFilters.ignore_ingredients.length }}) diff --git a/src/components/Cocktail/IngredientModal.vue b/src/components/Cocktail/IngredientModal.vue index cfca14e6..7ca55483 100644 --- a/src/components/Cocktail/IngredientModal.vue +++ b/src/components/Cocktail/IngredientModal.vue @@ -20,7 +20,6 @@ interface FinderIngredient { const emit = defineEmits(['close', 'ingredient-changed']) const props = defineProps<{ cocktailIngredient: CocktailIngredient, - searchHost: string, searchToken: string, }>() @@ -61,7 +60,7 @@ function selectIngredient(item: FinderIngredient): void {

{{ t('ingredient.units-help') }}

- +
{{ t('ingredient.dialog.current') }}:

{{ localCocktailingredient.ingredient.name }}

diff --git a/src/components/Cocktail/SubstituteModal.vue b/src/components/Cocktail/SubstituteModal.vue index 24f4be7d..01438d3b 100644 --- a/src/components/Cocktail/SubstituteModal.vue +++ b/src/components/Cocktail/SubstituteModal.vue @@ -3,7 +3,7 @@
{{ $t('ingredient.dialog.select-substitutes') }}

{{ $t('ingredient.dialog.select-substitutes-for', {name: cocktailIngredient.ingredient.name}) }}

- +

{{ $t('substitutes') }}:

@@ -61,10 +61,6 @@ export default { AmountInput, }, props: { - searchHost: { - type: String, - required: true, - }, searchToken: { type: String, required: true, diff --git a/src/components/Ingredient/IngredientForm.vue b/src/components/Ingredient/IngredientForm.vue index 213e2699..9681c568 100644 --- a/src/components/Ingredient/IngredientForm.vue +++ b/src/components/Ingredient/IngredientForm.vue @@ -53,7 +53,7 @@
- +
{{ ingredient.parent_ingredient.name }} · {{ $t('remove') }}
@@ -63,7 +63,7 @@
- +
    diff --git a/src/components/IngredientFinder.vue b/src/components/IngredientFinder.vue index 4ec5a320..8671c871 100644 --- a/src/components/IngredientFinder.vue +++ b/src/components/IngredientFinder.vue @@ -34,6 +34,7 @@ import { instantMeiliSearch } from '@meilisearch/instant-meilisearch' import OverlayLoader from './OverlayLoader.vue' import IngredientImage from './Ingredient/IngredientImage.vue' import BarAssistantClient from '@/api/BarAssistantClient' +import AppState from '@/AppState'; export default { components: { @@ -41,10 +42,6 @@ export default { IngredientImage }, props: { - searchHost: { - type: String, - required: true, - }, searchToken: { type: String, required: true, @@ -78,6 +75,8 @@ export default { }, emits: ['update:modelValue', 'ingredientSelected'], data() { + const appState = new AppState(); + return { isLoading: false, currentQuery: this.initialQuery, @@ -88,7 +87,7 @@ export default { }, }, searchClient: instantMeiliSearch( - this.searchHost, + appState.bar.search_host, this.searchToken, ).searchClient, } diff --git a/src/components/Search/FilterIngredientsModal.vue b/src/components/Search/FilterIngredientsModal.vue index 500dc2fe..5e936851 100644 --- a/src/components/Search/FilterIngredientsModal.vue +++ b/src/components/Search/FilterIngredientsModal.vue @@ -2,7 +2,7 @@
    {{ title }}
    - +
    {{ ing.name }} @@ -26,10 +26,6 @@ export default { IngredientFinder, }, props: { - searchHost: { - type: String, - required: true, - }, searchToken: { type: String, required: true,