import request from '/@/utils/request';

/**
 * @method getMenuList 获取全部菜单/或者单条
 * @method getMenuTree 获取菜单树
 * @method setMenu 添加菜单
 * @method putMenu 修改惨淡
 */
export function menuApi() {
    return {
        getMenuList: (params?: object) => {
            return request({
                url: 'system/menu/v1',
                method: 'get',
                params,
            });
        },
        getMenuTree: () => {
            return request({
                url: 'system/menu/v1/selectTree',
                method: 'get'
            });
        },
        delMenu: (data?: object) => {
            return request({
                url: 'system/menu/v1/' + data,
                method: 'delete',
            });
        },
        setMenu: (data?: object) => {
            return request({
                url: 'system/menu/v1',
                method: 'post',
                data,
            });
        },
        putMenu: (data?: object) => {
            return request({
                url: 'system/menu/v1',
                method: 'puts',
                data,
            });
        },

    };
}
