import request from '@/utils/request'

export function getAllRoles() {
  return request({
    url: '/backend/allRoles',
    method: 'get'
  })
}

export function getRoleById(id) {
  return request({
    url: `/backend/roles/${id}`,
    method: 'get'
  })
}

export function createRole(data) {
  return request({
    url: '/backend/roles',
    method: 'post',
    data
  })
}

export function updateRole(id, data) {
  return request({
    url: `/backend/roles/${id}`,
    method: 'put',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: `/backend/roles/${id}`,
    method: 'delete'
  })
}
