mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 04:39:54 -05:00
fixed model switcher
This commit is contained in:
@@ -32,6 +32,14 @@ const editorComponent = shallowRef(defineAsyncComponent(() => import(`@/componen
|
||||
const model = defineModel<Boolean|undefined>({default: undefined})
|
||||
const dialogActivator = (model.value !== undefined) ? undefined : props.activator
|
||||
|
||||
/**
|
||||
* for some reason editorComponent is not updated automatically when prop is changed
|
||||
* because of this watch prop changes and update manually if prop is changed
|
||||
*/
|
||||
watch(() => props.model, () => {
|
||||
editorComponent.value = defineAsyncComponent(() => import(`@/components/model_editors/${getGenericModelFromString(props.model, t).model.name}Editor.vue`))
|
||||
})
|
||||
|
||||
/**
|
||||
* Allow opening the model edit dialog trough v-model property of the dialog by watching for model changes
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<template v-if="route.name == 'ModelListPage'">
|
||||
<v-divider></v-divider>
|
||||
<v-list-item v-for="m in getListModels()"
|
||||
:to="{ name: 'ModelListPage', params: {model: m.name} }">
|
||||
:to="{ name: 'ModelListPage', params: {model: m.name.toLowerCase()} }">
|
||||
<template #prepend>
|
||||
<v-icon :icon="m.icon"></v-icon>
|
||||
</template>
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
|
||||
import {computed, onMounted, ref} from "vue";
|
||||
import {useShoppingStore} from "@/stores/ShoppingStore";
|
||||
import {ApiApi, Food, IngredientString, ShoppingListEntry, ShoppingListRecipe, Supermarket, Unit} from "@/openapi";
|
||||
import {ApiApi, Food, IngredientString, ResponseError, ShoppingListEntry, ShoppingListRecipe, Supermarket, Unit} from "@/openapi";
|
||||
import {ErrorMessageType, PreparedMessage, useMessageStore} from "@/stores/MessageStore";
|
||||
import ShoppingLineItem from "@/components/display/ShoppingLineItem.vue";
|
||||
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
|
||||
@@ -256,6 +256,10 @@ onMounted(() => {
|
||||
if (useUserPreferenceStore().deviceSettings.shopping_selected_supermarket != null) {
|
||||
new ApiApi().apiSupermarketRetrieve({id: useUserPreferenceStore().deviceSettings.shopping_selected_supermarket!.id!}).then(r => {
|
||||
useUserPreferenceStore().deviceSettings.shopping_selected_supermarket = r
|
||||
}).catch(err => {
|
||||
if (err instanceof ResponseError && err.response.status == 404) {
|
||||
useUserPreferenceStore().deviceSettings.shopping_selected_supermarket = null
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user