export const buildUrl = (appBase, path) => new URL(path, appBase).toString(); export const postAction = async (url, csrf, data = {}) => { const body = new URLSearchParams({ ...data, [csrf.key]: csrf.token }); return fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json', 'X-Requested-With': 'fetch' }, body }); }; export const badgeHtml = (gridjs, value = '') => { const safe = value ?? ''; return gridjs.html(`${safe}`); };