import params from "../parameters"; //for server URL
+// TODO: replace by fetch API ?
+// https://www.sitepoint.com/xmlhttprequest-vs-the-fetch-api-whats-best-for-ajax-in-2019/
+
// From JSON (encoded string values!) to "arg1=...&arg2=..."
function toQueryString(data)
{
}
xhr.open(method, params.serverUrl + url, true);
xhr.setRequestHeader('X-Requested-With', "XMLHttpRequest");
- // Next line because logout and authenticate set (cross-domain in dev mode) cookies
- if (url.startsWith("/authenticate") || url.startsWith("/logout"))
+ // Next line to allow cross-domain cookies in dev mode (TODO: if...)
+ if (params.cors)
xhr.withCredentials = true;
if (["POST","PUT"].includes(method))
{