browser: simplify logServer

Use "fetch()" function to save logging client data
to server side.

Change-Id: I8b6a94b7ad7ae02ca00666759e3695867df4d372
Signed-off-by: Henry Castro <hcastro@collabora.com>
This commit is contained in:
Henry Castro 2023-08-21 13:58:39 -04:00 committed by Caolán McNamara
parent 9f6824a620
commit 91a5831636

View file

@ -21,11 +21,11 @@ window.app = {
(global.socket instanceof global.app.definitions.Socket) && global.socket.connected()) {
global.socket.sendMessage(log);
} else {
var req = new XMLHttpRequest();
var url = global.location.protocol + '//' + global.location.host + global.location.pathname.match(/.*\//) + 'logging.html';
req.open('POST', url, true);
req.setRequestHeader('Content-type','application/json; charset=utf-8');
req.send(log);
fetch(global.location.pathname.match(/.*\//) + 'logging.html', {
method: 'POST',
headers: { 'Content-Type' : 'application/json' },
body: log
});
}
};