user.js
607 Bytes
import store from '../index'
import router, { resetRouter } from '@/router'
import Cookies from 'js-cookie';
const state = {
name: Cookies.get('username'),
avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
userInfo: null
}
const mutations = {
SET_NAME: (state, name) => {
state.name = name
},
SET_AVATAR: (state, avatar) => {
state.avatar = avatar
},
SET_USERINFO: (state, userInfo) => {
state.userInfo = userInfo
}
}
const actions = {
}
export default {
namespaced: true,
state,
mutations,
actions
}