import request from '/@/utils/request';
import Http from '/@/utils/net/Http';
import Menu from '../Menu';
/**
 * 后端控制菜单模拟json，路径在 https://gitee.com/lyt-top/vue-next-admin-images/tree/master/menu
 * 后端控制路由，isRequestRoutes 为 true，则开启后端控制路由
 * @method getMenuAdmin 获取后端动态路由菜单(admin)
 * @method getMenuTest 获取后端动态路由菜单(test)
 */
export function useMenuApi() {
	return {
		getMenuAdmin: async (params?: object) => {
			//TODO: 要改成远程获取		
			let res: any = await Menu.getList();
			let menu = {
				code: 0,
				type: "adminMenu",
				data: res.data.menu
			}
			console.log("menu result", menu);
			return menu;
		},
		getMenuTest: (params?: object) => {
			return request({
				url: '/gitee/lyt-top/vue-next-admin-images/raw/master/menu/testMenu.json',
				method: 'get',
				params,
			});
		},
	};
}
