From 430a6c37d4de4c5bb2de671be7e31fb1c07dd9fb Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Wed, 11 Apr 2018 10:49:34 +0200 Subject: [PATCH] Save last used mensa in localStorage --- src/App.vue | 5 +++++ src/store/index.js | 1 + 2 files changed, 6 insertions(+) diff --git a/src/App.vue b/src/App.vue index cae0a39..e57e356 100644 --- a/src/App.vue +++ b/src/App.vue @@ -95,6 +95,11 @@ export default { } }, created() { + let where = window.localStorage.getItem('mensa_where') + if (where !== null) { + this.where = where + } + this.$store.dispatch('loadMeals', { when: this.when, where: this.where diff --git a/src/store/index.js b/src/store/index.js index f8337f3..db901f7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -13,6 +13,7 @@ const state = { const mutations = { updateWhere(state, where) { state.where = where + window.localStorage.setItem('mensa_where', where) }, updateWhen(state, when) {