Skip to content

Commit 079e9f4

Browse files
authored
Create users.js
1 parent 91246c4 commit 079e9f4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/store/modules/users.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import axios from 'axios'
2+
3+
export default {
4+
state: {
5+
user: null
6+
},
7+
mutations: {
8+
updateCurrentUser (state, user) {
9+
state.user = user
10+
}
11+
},
12+
getters: {
13+
},
14+
actions: {
15+
signIn ({commit}) {
16+
axios.post('/api/sign-in')
17+
.then(result => commit('updateCurrentUser', result.data))
18+
.catch(console.error)
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)