file name and location updayed for better be
This commit is contained in:
22
zustand/useCategory.ts
Normal file
22
zustand/useCategory.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { CategoryType } from "@/lib/types";
|
||||
import { create } from "zustand";
|
||||
|
||||
interface CategoryZustandType {
|
||||
category: CategoryType;
|
||||
setCategory: (category: CategoryType) => void;
|
||||
clearCatalog: () => void;
|
||||
}
|
||||
|
||||
const demoCategory: CategoryType = {
|
||||
id: 0,
|
||||
name: "",
|
||||
description: "",
|
||||
image: "",
|
||||
have_sub_category: false,
|
||||
};
|
||||
|
||||
export const useCategory = create<CategoryZustandType>((set) => ({
|
||||
category: demoCategory,
|
||||
setCategory: (data) => set({ category: data }),
|
||||
clearCatalog: () => set({ category: demoCategory }),
|
||||
}));
|
||||
Reference in New Issue
Block a user