import request from '@/axios'
import { getAdmins, AddAdmins, putAdmins } from './types'
import { REQUEST_BASE } from '@/constants'

export const getUserRole = (params: getAdmins) => {
  return request.get({ url: `${REQUEST_BASE}/admins`, params })
}
export const addUserRole = (params: AddAdmins) => {
  return request.post({ url: `${REQUEST_BASE}/admins`, data: params })
}
export const putUserRoleStatus = (params: putAdmins) => {
  return request.put({ url: `${REQUEST_BASE}/admins/set_status/${params.id}/${params.status}` })
}
export const delUserRole = (params: { id: number }) => {
  return request.delete({ url: `${REQUEST_BASE}/admins/${params.id}` })
}

export const putUserRole = (params: AddAdmins) => {
  return request.put({ url: `${REQUEST_BASE}/admins/${params.id}`, data: params })
}
