|
@@ -1,4 +1,4 @@
|
|
|
-import { LOGIN,GET_TOKEN } from '@/api'
|
|
|
+import { LOGIN,GET_TOKEN,GetInfo } from '@/api'
|
|
|
import { getToken, setToken, removeToken } from '@/utils/auth'
|
|
|
import axios from '@/axios'
|
|
|
const user = {
|
|
@@ -43,8 +43,10 @@ const user = {
|
|
|
GET_TOKEN({ state, commit }, data) {
|
|
|
console.log(data);
|
|
|
axios.post(GET_TOKEN, data).then(res => {
|
|
|
+
|
|
|
if (res && res.code == '999') {
|
|
|
commit('SET_TOKEN', data.data);
|
|
|
+ sessionStorage.setItem("accessToken",data.data)
|
|
|
this.$router.push("/home");
|
|
|
} else {
|
|
|
this.$router.push("/");
|
|
@@ -52,13 +54,14 @@ const user = {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- GetInfo({ commit, state }) {
|
|
|
+ GetInfo({ commit, state }, data) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- getInfo(state.token).then(response => {
|
|
|
+ axios.post(GetInfo, data).then(response => {
|
|
|
const data = response.data
|
|
|
- commit('SET_ROLES', data.roles)
|
|
|
+ debugger
|
|
|
+ commit('SET_ROLES', data.role)
|
|
|
commit('SET_NAME', data.name)
|
|
|
- commit('SET_AVATAR', data.avatar)
|
|
|
+ commit('SET_AVATAR', data.imgUrl)
|
|
|
resolve(response)
|
|
|
}).catch(error => {
|
|
|
reject(error)
|