user.js 645 Bytes
import store from '../index'
import router, { resetRouter } from '@/router'
import { Message } from "element-ui";
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
}