init project portal web
This commit is contained in:
19
lib/price-plan/view-model/sidebar-view-model.ts
Normal file
19
lib/price-plan/view-model/sidebar-view-model.ts
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user