import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { Command, CommandParam } from './model';

export async function listCommand(params: CommandParam) {
  const res = await request.get<ApiResult<PageResult<Command>>>(
    '/system/command',
    { params }
  );
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
