2025-06-26 13:58:53 +00:00
|
|
|
import { PagedAndSortedResultRequestDto, PagedResultDto } from '@/proxy/abp'
|
|
|
|
|
import { MenuDto } from '@/proxy/menus/models'
|
2025-05-06 06:45:49 +00:00
|
|
|
import apiService, { Config } from '@/services/api.service'
|
|
|
|
|
|
|
|
|
|
export class MenuService {
|
|
|
|
|
apiName = 'Default'
|
|
|
|
|
|
|
|
|
|
// create = (input: MenuDto, config?: Partial<Rest.Config>) =>
|
|
|
|
|
// this.restService.request<any, MenuDto>(
|
|
|
|
|
// {
|
|
|
|
|
// method: 'POST',
|
|
|
|
|
// url: '/api/app/menu',
|
|
|
|
|
// body: input,
|
|
|
|
|
// },
|
|
|
|
|
// { apiName: this.apiName, ...config },
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
|
|
// delete = (id: string, config?: Partial<Rest.Config>) =>
|
|
|
|
|
// this.restService.request<any, void>(
|
|
|
|
|
// {
|
|
|
|
|
// method: 'DELETE',
|
|
|
|
|
// url: `/api/app/menu/${id}`,
|
|
|
|
|
// },
|
|
|
|
|
// { apiName: this.apiName, ...config },
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
|
|
// get = (id: string, config?: Partial<Rest.Config>) =>
|
|
|
|
|
// this.restService.request<any, MenuDto>(
|
|
|
|
|
// {
|
|
|
|
|
// method: 'GET',
|
|
|
|
|
// url: `/api/app/menu/${id}`,
|
|
|
|
|
// },
|
|
|
|
|
// { apiName: this.apiName, ...config },
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
|
|
getList = (input: PagedAndSortedResultRequestDto, config?: Partial<Config>) =>
|
|
|
|
|
apiService.fetchData<PagedResultDto<MenuDto>, 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<Rest.Config>) =>
|
|
|
|
|
// this.restService.request<any, MenuDto>(
|
|
|
|
|
// {
|
|
|
|
|
// 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,
|
|
|
|
|
})
|
|
|
|
|
}
|