user.js 474 B

123456789101112131415161718
  1. /*
  2. * @Description: 获取用户信息更新
  3. * @Author: 欧阳承珺
  4. * @LastEditors: 欧阳承珺
  5. * @Date: 2022-11-08 09:15:06
  6. * @LastEditTime: 2022-11-16 13:58:30
  7. */
  8. export default function({store, app: {$axios}}) {
  9. if(store?.state?.token !== '') {
  10. if( !store.state.userInfo.id ){
  11. return $axios.get('members/getMemberInfo').then((res)=> {
  12. if(res.code === 200) {
  13. store.commit('setUser',res.result.memberInfo)
  14. }
  15. })
  16. }
  17. }
  18. }