21 lines
551 B
TypeScript
21 lines
551 B
TypeScript
import { SubCategoryType } from "@/lib/types";
|
|
import { create } from "zustand";
|
|
|
|
interface SubCategoryZustandType {
|
|
subCategory: SubCategoryType;
|
|
setSubCategory: (subCategory: SubCategoryType) => void;
|
|
clearSubCategory: () => void;
|
|
}
|
|
|
|
const demoSubCategory = {
|
|
id: 0,
|
|
name: "",
|
|
category: 0,
|
|
image: "",
|
|
};
|
|
export const useSubCategory = create<SubCategoryZustandType>((set) => ({
|
|
subCategory: demoSubCategory,
|
|
setSubCategory: (data) => set({ subCategory: data }),
|
|
clearSubCategory: () => set({ subCategory: demoSubCategory }),
|
|
}));
|