Commit b3a6147f authored by Cyrille Chopelet's avatar Cyrille Chopelet

[JS] Simplify JS with modern API

parent 98bcea15
......@@ -5093,12 +5093,6 @@
"mime-types": "^2.1.12"
}
},
"form-serialize": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/form-serialize/-/form-serialize-0.7.2.tgz",
"integrity": "sha1-sKL/DCICb7bT0VydM/beakMuRzI=",
"dev": true
},
"from2": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz",
......
import serialize from 'form-serialize';
/** ID of the comment submission form. */
const STATICMAN_FORM_ID = 'staticman-form';
......@@ -9,6 +7,14 @@ const STATICMAN_REPLY_BTN_SELECTOR = '#comments .reply-btn';
/** ID of the span used to display the author being replied to. */
const REPLYING_TO_AUTHOR_ID = 'replying-to';
const serialize = form => {
const data = new URLSearchParams();
for (const pair of new FormData(form)) {
data.append(pair[0], pair[1]);
}
return data;
}
/**
* Submits a form to the Staticman server asynchronously.
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment