@opengis/fastify-table
Version:
core-plugins
21 lines (20 loc) • 635 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, hash.icon);
}
if (hash.edit) {
return buttonEdit(hash.token, hash.title, hash.icon);
}
return button(hash.token, hash.title);
}