import { defineStore } from 'pinia'
import { t } from '@/locale'
import { redirect, getToken } from '@/utils/common'

interface GoodsDetail {
    goodsDetail: AnyObject
}

const usePintuanGoodsDetailStore = defineStore('goodsDetail', {
    state: (): GoodsDetail => {
        return {
            goodsDetail: {}
        }
    },
    actions: {
        setGoodsDetail(data: any) { // 商品详情
            Object.assign(this.goodsDetail, data);
        },
        removeGoodsDetail(){ // 商品详情
            this.goodsDetail = {}
        },
        removePartGoodsDetail(data: any) { // 商品详情
            // this.goodsDetail = {}
            Object.keys(data).forEach(key => {
                delete this.goodsDetail[key]
            })
         }
    }
})

export default usePintuanGoodsDetailStore
