diff --git a/src/views/Home.vue b/src/views/Home.vue index 1122558..40b4dca 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -48,31 +48,27 @@ export default { } }, mounted() { - if (localStorage.getItem('transactions')) { + if (localStorage.getItem('transactionStorage')) { try { - this.transactions = JSON.parse(localStorage.getItem('transactions')); + this.transactions = JSON.parse(localStorage.getItem('transactionStorage')); } catch(e) { alert(e); - localStorage.removeItem('transactions'); + localStorage.removeItem('transactionStorage'); } } }, - watch: { - transactions(newTransaction) { - localStorage.transactions = [...localStorage.transactions, newTransaction]; - } - }, methods: { deleteTransaction(id) { this.transactions = this.transactions.filter(transaction => transaction.id !== id); + localStorage.setItem("transactionStorage", JSON.stringify(this.transactions)); }, addTransaction(newTransaction) { this.transactions.push(newTransaction); this.saveTransactions(); }, saveTransactions() { - alert(JSON.stringify(this.transactions)); - localStorage.setItem('transactions', JSON.stringify(this.transactions)); + localStorage.setItem("lastname", "Smith"); + localStorage.setItem("transactionStorage", JSON.stringify(this.transactions)); } } } diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..ab7013e --- /dev/null +++ b/vue.config.js @@ -0,0 +1,5 @@ +module.exports = { + configureWebpack: { + devtool: 'source-map' + } + } \ No newline at end of file