X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Futils%2Fajax.js;h=4573dd853abc3ad43c54f9be9a9971ccc9feb899;hp=e539f4685d177e0c443fe69145709bee2a132786;hb=f0c68a04e31bb6a4b2f8b94a532ef3ca2eebbe3e;hpb=a97bdbda4ecf83645d409b717e36828784d1450d diff --git a/client/src/utils/ajax.js b/client/src/utils/ajax.js index e539f468..4573dd85 100644 --- a/client/src/utils/ajax.js +++ b/client/src/utils/ajax.js @@ -1,8 +1,8 @@ import params from "../parameters"; //for server URL +import { store } from "../store"; //for translations // TODO: replace by fetch API ? // https://www.sitepoint.com/xmlhttprequest-vs-the-fetch-api-whats-best-for-ajax-in-2019/ -// Problem: fetch() does not set req.xhr... see access/ajax() security especially for /whoami // From JSON (encoded string values!) to "arg1=...&arg2=..." function toQueryString(data) { @@ -25,7 +25,7 @@ export function ajax(url, method, data, success, error) { if (!success) success = () => {}; //by default, do nothing if (!error) error = errmsg => { - alert(errmsg); + alert(store.state.tr[errmsg] || errmsg); }; xhr.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) {