|
|
@@ -10,17 +10,12 @@ const auth = new Auth(storage); |
|
|
|
|
|
|
|
const state = { |
|
|
|
authenticated: auth.isAuthenticated(), |
|
|
|
email: '', |
|
|
|
passwords: [] |
|
|
|
email: '' |
|
|
|
}; |
|
|
|
|
|
|
|
const mutations = { |
|
|
|
setPasswords(state, passwords){ |
|
|
|
state.passwords = passwords |
|
|
|
}, |
|
|
|
logout(state){ |
|
|
|
state.authenticated = false; |
|
|
|
state.passwords = []; |
|
|
|
}, |
|
|
|
userAuthenticated(state, user){ |
|
|
|
state.authenticated = true; |
|
|
@@ -33,14 +28,12 @@ const actions = { |
|
|
|
logout: ({commit}) => { |
|
|
|
auth.logout(); |
|
|
|
commit('logout'); |
|
|
|
}, |
|
|
|
setPasswords: ({commit}, password) => commit('setPasswords', password), |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const getters = { |
|
|
|
isAuthenticated: state => state.authenticated, |
|
|
|
isGuest: state => !state.authenticated, |
|
|
|
passwords: state => state.passwords, |
|
|
|
email: state => state.email, |
|
|
|
baseURL: state => state.baseURL |
|
|
|
}; |
|
|
|