19 lines
658 B
TypeScript
19 lines
658 B
TypeScript
import CommonData from "@/lib/helper/query-data"
|
|
import { pricePlanRepository } from "@/lib/price-plan/data/repository"
|
|
import { PricePlanMenuModel } from "@/lib/price-plan/model/menu-model"
|
|
import { useQuery } from "@tanstack/react-query"
|
|
|
|
export const useMenuPricePlan = () => {
|
|
const query = useQuery({
|
|
queryKey: ["priceplan-menu"],
|
|
queryFn: pricePlanRepository.getMenuList,
|
|
})
|
|
|
|
return new CommonData<PricePlanMenuModel[], any>({
|
|
isLoading: query.isLoading,
|
|
isError: query.isError,
|
|
error: query.error,
|
|
data: query.data ? PricePlanMenuModel.fromJSON(query.data) : [],
|
|
extra: null
|
|
})
|
|
} |