baseline
This commit is contained in:
19
web/js/pages/app-list-utils.js
Normal file
19
web/js/pages/app-list-utils.js
Normal file
@@ -0,0 +1,19 @@
|
||||
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(`<span class="badge" data-variant="neutral">${safe}</span>`);
|
||||
};
|
||||
Reference in New Issue
Block a user