import req from 'editorReq'; import { useQuery } from 'react-query'; import { ICategory, IResponce, TResponce1 } from 'src/type'; import { API } from './config'; const PRODUCT_CATEGORY_GET_ALL = `${API}/navigation/lists?limit=5000&order=DESC&sort=sort`; export async function getAll() { return req({ url: PRODUCT_CATEGORY_GET_ALL, method: 'GET', data: {} }) as Promise< TResponce1 >; } export const useProductCategory = () => { const { data, ...rest } = useQuery(PRODUCT_CATEGORY_GET_ALL, getAll); return { data, ...rest, }; }; export interface IProductCategorys { firstPage: boolean; hasNextPage: boolean; hasPrePage: boolean; items: IProductCategory[]; lastPage: boolean; limit: number; nextPage: number; page: number; prePage: number; totalCount: number; totalPages: number; } export interface IProductCategory extends ICategory { arr_child: string; cover_path: string; created_at: string; crumbs: string; deep: number; deleted_at: null | string; first_fee_splitting: null | string; path: string; root_id: string; second_fee_splitting: null | string; show_config: { show_location: string; is_expand: number }; sort: number; system: string; updated_at: string; _id: string; }