catalog part connected to backend , added empty data and loading component
This commit is contained in:
19
store/useCategory.ts
Normal file
19
store/useCategory.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { CategoryType } from "@/lib/types";
|
||||
import { create } from "zustand";
|
||||
|
||||
interface CategoryZustandType {
|
||||
category: CategoryType;
|
||||
setCategory: (category: CategoryType) => void;
|
||||
}
|
||||
|
||||
const demoCategory: CategoryType = {
|
||||
id: 0,
|
||||
name: "",
|
||||
description: "",
|
||||
image: "",
|
||||
};
|
||||
|
||||
export const useCategory = create<CategoryZustandType>((set) => ({
|
||||
category: demoCategory,
|
||||
setCategory: (data) => set({ category: data }),
|
||||
}));
|
||||
0
store/useProduct.ts
Normal file
0
store/useProduct.ts
Normal file
18
store/useSubCategory.ts
Normal file
18
store/useSubCategory.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { SubCategoryType } from "@/lib/types";
|
||||
import { create } from "zustand";
|
||||
|
||||
interface SubCategoryZustandType {
|
||||
subCategory: SubCategoryType;
|
||||
setSubCategory: (subCategory: SubCategoryType) => void;
|
||||
}
|
||||
|
||||
const demoSubCategory = {
|
||||
id: 0,
|
||||
name: "",
|
||||
category: 0,
|
||||
image: "",
|
||||
};
|
||||
export const useSubCategory = create<SubCategoryZustandType>((set) => ({
|
||||
subCategory: demoSubCategory,
|
||||
setSubCategory: (data) => set({}),
|
||||
}));
|
||||
Reference in New Issue
Block a user