import apiService, { Config } from '@/services/api.service' import type { MenuDto } from './models' import { PagedAndSortedResultRequestDto, PagedResultDto } from '../abp' export class MenuService { apiName = 'Default' // create = (input: MenuDto, config?: Partial) => // this.restService.request( // { // method: 'POST', // url: '/api/app/menu', // body: input, // }, // { apiName: this.apiName, ...config }, // ) // delete = (id: string, config?: Partial) => // this.restService.request( // { // method: 'DELETE', // url: `/api/app/menu/${id}`, // }, // { apiName: this.apiName, ...config }, // ) // get = (id: string, config?: Partial) => // this.restService.request( // { // method: 'GET', // url: `/api/app/menu/${id}`, // }, // { apiName: this.apiName, ...config }, // ) getList = (input: PagedAndSortedResultRequestDto, config?: Partial) => apiService.fetchData, PagedAndSortedResultRequestDto>( { method: 'GET', url: '/api/app/menu', params: { sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount, }, }, { apiName: this.apiName, ...config }, ) // update = (id: string, input: MenuDto, config?: Partial) => // this.restService.request( // { // method: 'PUT', // url: `/api/app/menu/${id}`, // body: input, // }, // { apiName: this.apiName, ...config }, // ) } export const getMenus = async (skipCount = 0, maxResultCount = 1000, sorting = 'order') => { const menuService = new MenuService() return await menuService.getList({ sorting, skipCount, maxResultCount, }) }