slide
This commit is contained in:
27
store/subCategory.ts
Normal file
27
store/subCategory.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
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 },
|
||||
}),
|
||||
}));
|
||||
Reference in New Issue
Block a user