import { UserVipInfo } from "@/api/user"; import { create } from "zustand"; interface State { vipData: UserVipInfo | null; } interface Action { setVipData: (value: State["vipData"]) => void; } const initialState: State = { vipData: { vip_exp: 0, vip_level: 0, vip_next_level: 0, vip_score_exp: 0, vip_cashback: 0 }, }; /** * @description vip */ export const useVipStore = create()((set, get) => { return { ...initialState, setVipData: (values: State["vipData"]) => set((state) => { return values ? { ...state, vipData: values } : { ...state, vipData: initialState.vipData }; }), reset: () => set(initialState), }; });