-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.js
36 lines (29 loc) · 883 Bytes
/
1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* i store data user before from vuex when user succes login */
import { getLocalUser } from './helpers/auth';
const user = getLocalUser();
state : {
currentUser: user,
},
mutations : {
state.currentUser = Object.assign({}, payload.user, {token: payload.access_token});
localStorage.setItem("user", JSON.stringify(state.currentUser));
}
/* end data store.js */
methods: {
getData() {
axios.get('/api/companies/usercompany/'+this.currentUser.id)
.then((response) => {
this.form = response.data.data;
console.log(this.currentUser)
let user = JSON.parse(localStorage.getItem("user"));
user.id = 3;
localStorage.setItem("user", JSON.stringify(user));
console.log(this.currentUser)
});
},
},
computed: {
currentUser() {
return this.$store.getters.currentUser;
},
},