diff --git a/src/App.vue b/src/App.vue index 53749eb..304dd89 100644 --- a/src/App.vue +++ b/src/App.vue @@ -23,6 +23,20 @@ export default defineComponent({ this.store.setupAPIData(); }, + computed: { + currentStockString() { + return this.store.stockString; + }, + }, + + watch: { + currentStockString(val: string) { + if (val != this.store.chosenStorageStockString) { + this.store.chosenStorageStockName = ''; + } + }, + }, + methods: { loadStockDataFromStorage() { const savedData = localStorage.getItem('savedStockData'); diff --git a/src/components/tabs/StockListTab.vue b/src/components/tabs/StockListTab.vue index e7da9dd..0a05915 100644 --- a/src/components/tabs/StockListTab.vue +++ b/src/components/tabs/StockListTab.vue @@ -22,12 +22,6 @@ diff --git a/src/components/tabs/StorageTab.vue b/src/components/tabs/StorageTab.vue index aa42553..e546ecf 100644 --- a/src/components/tabs/StorageTab.vue +++ b/src/components/tabs/StorageTab.vue @@ -110,6 +110,7 @@ export default defineComponent({ delete this.store.storageStockData[stockName]; this.store.chosenStorageStockName = ''; + this.store.chosenStorageStockString = ''; try { localStorage.setItem('savedStockData', JSON.stringify(this.store.storageStockData)); @@ -122,6 +123,8 @@ export default defineComponent({ try { this.loadStockFromString(this.store.storageStockData[stockName].stockString); this.store.chosenStorageStockName = stockName; + this.store.chosenStorageStockString = this.store.storageStockData[stockName].stockString; + this.$router.push('/'); } catch (error) { console.log(error); diff --git a/src/components/tabs/stock-list/StockActions.vue b/src/components/tabs/stock-list/StockActions.vue index 40f6d05..6b3ed40 100644 --- a/src/components/tabs/stock-list/StockActions.vue +++ b/src/components/tabs/stock-list/StockActions.vue @@ -247,8 +247,6 @@ export default defineComponent({ if (!entryName) return; - let updatedAt: number | undefined = undefined; - if (entryName in this.store.storageStockData) { const overwriteDataConfirm = confirm(this.$t('stocklist.prompt-bookmark-overwrite')); @@ -267,6 +265,7 @@ export default defineComponent({ try { localStorage.setItem('savedStockData', JSON.stringify(this.store.storageStockData)); this.store.chosenStorageStockName = entryName; + this.store.chosenStorageStockString = this.store.stockString; } catch (error) { console.error('Wystąpił błąd podczas zapisywania składu do localStorage!', error); } diff --git a/src/components/tabs/stock-list/StockSpecs.vue b/src/components/tabs/stock-list/StockSpecs.vue index e1388a9..afdac71 100644 --- a/src/components/tabs/stock-list/StockSpecs.vue +++ b/src/components/tabs/stock-list/StockSpecs.vue @@ -1,20 +1,25 @@