@opengis/fastify-table
Version:
core-plugins
22 lines (19 loc) • 575 B
JavaScript
import buttonAdd from "../utils/buttonAdd.js";
import buttonDel from "../utils/buttonDel.js";
import buttonEdit from "../utils/buttonEdit.js";
import button from "../utils/button.js";
export default function buttonHelper(data, opt) {
const { hash } = opt;
// console.log(params)
if (!hash.token) return "token empty";
if (hash.add) {
return buttonAdd(hash.token, hash.title);
}
if (hash.del) {
return buttonDel(hash.token, hash.title);
}
if (hash.edit) {
return buttonEdit(hash.token, hash.title);
}
return button(hash.token, hash.title);
}