import request from '@/utils/request'

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

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

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

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

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