Mercurial > gemma
comparison src/stores/user.js @ 3:1597506a2241 vue-cli
merge with vue-cli
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 13 Jun 2018 10:57:57 +0200 |
parents | |
children | 7c1bde663c8e |
comparison
equal
deleted
inserted
replaced
2:9c6f68a8e8b2 | 3:1597506a2241 |
---|---|
1 const User = { | |
2 namespaced: true, | |
3 state: { | |
4 authenticated: false, | |
5 authStatus: "error" | |
6 }, | |
7 getters: { | |
8 authenticated: state => { | |
9 return state.authenticated; | |
10 }, | |
11 authStatus: state => { | |
12 return state.authStatus; | |
13 } | |
14 }, | |
15 mutations: { | |
16 auth_success: state => { | |
17 state.authenticated = true; | |
18 } | |
19 }, | |
20 actions: { | |
21 auth({ commit }, user) { | |
22 const { username, password } = user; | |
23 if (username === "admin" && password === "secret") { | |
24 commit("auth_success"); | |
25 } | |
26 } | |
27 } | |
28 }; | |
29 | |
30 export default User; |