28 lines
553 B
TypeScript
28 lines
553 B
TypeScript
import { create } from "zustand";
|
|
|
|
// Type definition
|
|
interface SubCategory {
|
|
name: string;
|
|
id: number;
|
|
}
|
|
|
|
interface SubCategoryStore {
|
|
initialSubCategory: SubCategory;
|
|
setInitialSubCategory: (data: SubCategory) => void;
|
|
clearSubCategory: () => void;
|
|
}
|
|
|
|
export const useSubCategory = create<SubCategoryStore>((set) => ({
|
|
initialSubCategory: {
|
|
name: "",
|
|
id: 0,
|
|
},
|
|
|
|
setInitialSubCategory: (data) => set({ initialSubCategory: data }),
|
|
|
|
clearSubCategory: () =>
|
|
set({
|
|
initialSubCategory: { name: "", id: 0 },
|
|
}),
|
|
}));
|