import request from '@/utils/request';
import { useHttp } from '@crami/http';

interface SaveMenu {
  lang: string;
  connect: string;
  companyId: string;
  objectId: string;
  appId: string;
  permissionType: string; // PC/MOBILE/API
  userId: string;
  data: Array<any>;
}

// 获取授权应用
export async function getApplication() {
  return request.request<any, any>({
    url: '/system/fun/getApplication',
    method: 'POST',
  });
}

// 授权菜单保存
export async function saveMenu(data: SaveMenu) {
  return await useHttp({
    url: '/api/menupermission/menuPer/saveMenuPer',
    method: 'post',
    params: data,
  });
}
