You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
652 B
28 lines
652 B
import axios from 'axios';
|
|
import { message } from 'ant-design-vue';
|
|
import { getUserId } from 'config/api-user';
|
|
|
|
const actions = {
|
|
/**
|
|
* 通过userId获取token
|
|
* @param {any} commit
|
|
* @param {object} params 提交的参数
|
|
*/
|
|
async getUserId({ commit }, params) {
|
|
try {
|
|
const res = await getUserId({ params });
|
|
const { code, msg, data } = res.data;
|
|
if (code === 200) {
|
|
commit('sign', data.token);
|
|
commit('setUser', data);
|
|
return data;
|
|
} else {
|
|
throw msg;
|
|
}
|
|
} catch (error) {
|
|
throw error || '获取个人信息失败';
|
|
}
|
|
},
|
|
};
|
|
|
|
export default actions;
|
|
|