import { httpRoleAll, httpCardAll } from "/@/api/interest/account";

export async function createRoleOptions(): Promise<option[]> {
  const arr: option[] = [];
  const { code, data, message } = await httpRoleAll({});
  if (Number(code) === 0) {
    data.forEach(btn => {
      arr.push({ label: String(btn.name), value: String(btn.id) });
    });
  }

  return arr;
}

export async function createCardOptions(): Promise<option[]> {
  const arr: option[] = [];
  const { code, data, message } = await httpCardAll({});
  if (Number(code) === 0) {
    data.forEach(btn => {
      arr.push({ label: String(btn.title), value: String(btn.id) });
    });
  }

  return arr;
}
