import { defineStore } from 'pinia'
import router from "../router";

/**
 * 有关 user 用户的状态
 */
export const useUserStore = defineStore({
    id: 'user',
    state: () => {
        return {
            user: {
                name: '', // 昵称
                avatar: '',  // logo
            },
            dropList: [   // 头像处下拉列表菜单
            ]
        }
    },
    actions: {
        // 写入user资料
        setUserInfo(user) {
            this.user.name = user.name || this.user.name;
            this.user.avatar = user.avatar || this.user.avatar;
        },
        // 写入头像处下拉列表菜单
        setDropList(dropList) {
            this.dropList = dropList;
        }
    }
})
