isLoggedIn getter

This commit is contained in:
Ulf Gebhardt 2021-02-26 01:18:23 +01:00
parent b64d8969b5
commit c893c65a31
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD

View File

@ -5,7 +5,6 @@ import router from '../routes/router.js'
import loginAPI from '../apis/loginAPI' import loginAPI from '../apis/loginAPI'
import axios from 'axios' import axios from 'axios'
// TODO make persistent: https://translate.google.de/translate?hl=de&sl=en&u=https://sandulat.com/safely-persisting-vuex-store-in-local-storage/&prev=search&pto=aue
export const store = new Vuex.Store({ export const store = new Vuex.Store({
state: { state: {
session_id: null, session_id: null,
@ -26,9 +25,9 @@ export const store = new Vuex.Store({
}, },
// Retrieve a state variable // Retrieve a state variable
getters: { getters: {
/*isActive: (state, getters) => { isLoggedIn: (state /*, getters */) => {
return state.active; return state.session_id !== null;
}*/ }
}, },
// Syncronous mutation of the state // Syncronous mutation of the state
mutations: { mutations: {