mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-07 15:18:20 -05:00
fixed device setting supermarkt refresh
This commit is contained in:
@@ -9,15 +9,15 @@
|
|||||||
|
|
||||||
<b-tabs content-class="mt-2" v-model="current_tab" class="mt-md-1" style="margin-bottom: 20vh">
|
<b-tabs content-class="mt-2" v-model="current_tab" class="mt-md-1" style="margin-bottom: 20vh">
|
||||||
<template #tabs-end>
|
<template #tabs-end>
|
||||||
<li class="nav-item flex-grow-1" >
|
<li class="nav-item flex-grow-1">
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" >
|
<li class="nav-item">
|
||||||
<a href="#" class="nav-link" @click="useShoppingListStore().undoChange()"> <i class="fas fa-undo fa-fw"></i> </a>
|
<a href="#" class="nav-link" @click="useShoppingListStore().undoChange()"> <i class="fas fa-undo fa-fw"></i> </a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item dropdown d-none d-md-inline-block" >
|
<li class="nav-item dropdown d-none d-md-inline-block">
|
||||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-expanded="false">
|
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-expanded="false">
|
||||||
<i class="fas fa-download" ></i>
|
<i class="fas fa-download"></i>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<DownloadPDF dom="#shoppinglist" name="shopping.pdf" :label="$t('download_pdf')"
|
<DownloadPDF dom="#shoppinglist" name="shopping.pdf" :label="$t('download_pdf')"
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#" class="nav-link" id="id_filters_button">
|
<a href="#" class="nav-link" id="id_filters_button">
|
||||||
<i class="fas fa-filter fa-fw"/>
|
<i class="fas fa-filter fa-fw"/>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
@@ -351,7 +351,7 @@
|
|||||||
<template #title>
|
<template #title>
|
||||||
<div class="d-print-none">
|
<div class="d-print-none">
|
||||||
<i class="fas fa-user-cog fa-fw"></i>
|
<i class="fas fa-user-cog fa-fw"></i>
|
||||||
<!-- <span class="d-none d-lg-inline-block ml-1">{{ $t('Settings') }}</span>-->
|
<!-- <span class="d-none d-lg-inline-block ml-1">{{ $t('Settings') }}</span>-->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
@@ -562,6 +562,16 @@ export default {
|
|||||||
this.shopping_list_store.refreshFromAPI()
|
this.shopping_list_store.refreshFromAPI()
|
||||||
useUserPreferenceStore().loadUserSettings(true)
|
useUserPreferenceStore().loadUserSettings(true)
|
||||||
useUserPreferenceStore().loadDeviceSettings()
|
useUserPreferenceStore().loadDeviceSettings()
|
||||||
|
|
||||||
|
// update selected supermarkt because local setting become stale otherwise
|
||||||
|
if (useUserPreferenceStore().device_settings.shopping_selected_supermarket != null) {
|
||||||
|
let api = new ApiApiFactory()
|
||||||
|
api.retrieveSupermarket(useUserPreferenceStore().device_settings.shopping_selected_supermarket.id).then(r => {
|
||||||
|
useUserPreferenceStore().device_settings.shopping_selected_supermarket = r.data
|
||||||
|
useUserPreferenceStore().updateDeviceSettings()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
this.autoSyncLoop()
|
this.autoSyncLoop()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -693,6 +703,10 @@ export default {
|
|||||||
apiClient.updateSupermarket(this.shopping_list_store.supermarkets[index].id, this.shopping_list_store.supermarkets[index]).then((r) => {
|
apiClient.updateSupermarket(this.shopping_list_store.supermarkets[index].id, this.shopping_list_store.supermarkets[index]).then((r) => {
|
||||||
StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE)
|
StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE)
|
||||||
this.shopping_list_store.refreshFromAPI()
|
this.shopping_list_store.refreshFromAPI()
|
||||||
|
|
||||||
|
if (r.data.id === useUserPreferenceStore().device_settings.shopping_selected_supermarket.id){
|
||||||
|
useUserPreferenceStore().device_settings.shopping_selected_supermarket = r.data
|
||||||
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err)
|
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user