mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 01:35:17 +01:00
21 lines
471 B
JavaScript
21 lines
471 B
JavaScript
export const post = (url, params) =>
|
|
fetch(url, {
|
|
method: 'post',
|
|
cache: 'no-cache',
|
|
headers: {
|
|
Accept: 'application/json',
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify(params),
|
|
}).then(res => (res.status === 200 ? res.json() : null));
|
|
|
|
export const hook = (_this, method, callback) => {
|
|
const orig = _this[method];
|
|
|
|
return (...args) => {
|
|
callback.apply(null, args);
|
|
|
|
return orig.apply(_this, args);
|
|
};
|
|
};
|