// pinia仓库
import { defineStore } from "pinia"

export const useMainStore = defineStore("counter", {
    state: () => {
        return {
            token: 'INFJ',
            MBTI: '',    //测试结果
            prizeCode: 'DKS18', //兑换码
            prizeMoney: '8.88', //金额
            drawKey: '',
        }
    },
    // 相当于computed属性，对state进行二次加工
    getters: {},
    // 异步处理方法
    actions: {
        updateToken(token) {
            this.token = token
        },
        updatePrize(code, money) {
            this.prizeCode = code
            this.prizeMoney = money
        },
        updateMBTI(type) {
            this.MBTI = type
        },
        updateDrawKey(key) {
            this.drawKey = key
        }
    },
})
