user.js 472 B

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