From abe8817696fa8b459e612ad090c0231cea172581 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 13 Dec 2021 16:09:47 +0100 Subject: [PATCH] feat: Catch No Cookies --- frontend/src/main.js | 5 ++++ frontend/src/store/store.js | 60 ++++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/frontend/src/main.js b/frontend/src/main.js index cbd7383aa..101a9204d 100755 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -30,6 +30,11 @@ loadAllRules(i18n) addNavigationGuards(router, store, apolloProvider.defaultClient) +if (!store) { + // Please supply a support page + window.location.assign('https://gradido.net/') +} + /* eslint-disable no-new */ new Vue({ el: '#app', diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index c49197059..4cfe3c351 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -78,32 +78,38 @@ export const actions = { }, } -export const store = new Vuex.Store({ - plugins: [ - createPersistedState({ - storage: window.localStorage, - }), - ], - state: { - email: '', - language: null, - firstName: '', - lastName: '', - username: '', - description: '', - token: null, - isAdmin: false, - coinanimation: true, - newsletterState: null, - community: { - name: '', +let store + +try { + store = new Vuex.Store({ + plugins: [ + createPersistedState({ + storage: window.localStorage, + }), + ], + state: { + email: '', + language: null, + firstName: '', + lastName: '', + username: '', description: '', + token: null, + isAdmin: false, + coinanimation: true, + newsletterState: null, + community: { + name: '', + description: '', + }, + hasElopage: false, + publisherId: null, }, - hasElopage: false, - publisherId: null, - }, - getters: {}, - // Syncronous mutation of the state - mutations, - actions, -}) + getters: {}, + // Syncronous mutation of the state + mutations, + actions, + }) +} catch (error) {} + +export { store }