import service from '@/utils/service'

const baseUrl = process.env.VUE_APP_HOST + '/manager/api';

const tableApi = {};

tableApi.baseUrl = baseUrl;



tableApi.getButtonList = () => {
    return service({
        url: `${baseUrl}/button/list`,
        method: 'get',
    })
};
tableApi.addButton = data => {
    return service({
        url: `${baseUrl}/button/v1`,
        method: 'post',
        data:data
    })
};
tableApi.addSubButton = data => {
    return service({
        url: `${baseUrl}/subButton/v1`,
        method: 'post',
        data:data
    })
};


tableApi.deleteButton = id => {
    return service({
        url: `${baseUrl}/button/v1/${id}`,
        method: 'delete',
    })
};
tableApi.deleteSubButton = id => {
    return service({
        url: `${baseUrl}/subButton/v1/${id}`,
        method: 'delete',
    })
};
tableApi.getSubById = id =>{
    return service({
        url: `${baseUrl}/subButton/v1/${id}`,
        method: 'get',
    })
};

tableApi.updateSub = data =>{
    return service({
        url: `${baseUrl}/subButton/v1`,
        method: 'put',
        data:data
    })
};


tableApi.setMenu = () =>{
    return service({
        url: `${baseUrl}/menu/setMenu`,
        method: 'post',
    })
};


tableApi.getMenuList = data =>{
    return service({
        url: `${baseUrl}/menu/v1/list`,
        method: 'get',
        data:data
    })
};
tableApi.getMenuById = id =>{
    return service({
        url: `${baseUrl}/menu/v1/${id}`,
        method: 'get',
    })
};
tableApi.addMenu = data => {
    return service({
        url: `${baseUrl}/menu/v1`,
        method: 'post',
        data:data
    })
};
tableApi.deleteMenu = id => {
    return service({
        url: `${baseUrl}/menu/v1/${id}`,
        method: 'delete',
    })
};
tableApi.updateSub = data =>{
    return service({
        url: `${baseUrl}/menu/v1`,
        method: 'put',
        data:data
    })
};






export default tableApi
