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.

40 lines
772 B

import {checkWxmpRegister, getUserWechatByUserId} from '@/api/user'
2 years ago
const state = {
userInfo: {},
appId: ''
2 years ago
}
const mutations = {
SET_USER_INFO(state, userInfo) {
state.userInfo = userInfo
},
SET_APP_ID(state, appId) {
state.appId = appId
2 years ago
}
}
const actions = {
// 设置是否注册
getUserInfo({ commit}) {
2 years ago
return new Promise((resolve, reject) => {
if (Object.keys(state.userInfo).length) {
resolve(state.userInfo)
2 years ago
}
getUserWechatByUserId({
token: localStorage.getItem('token')
})
.then(res => {
commit('SET_USER_INFO', res)
resolve(res)
2 years ago
})
.catch(error => {
reject(error)
})
})
}
}
export default {
state,
mutations,
actions
}