Files
swingmusic-webclient/public/workers/logtrack.js
mungai-njoroge e88e6dcc2d add favorites on recently played
+ create track logger timestamp on track play start
2023-12-10 13:28:52 +03:00

16 lines
422 B
JavaScript

onmessage = (e) => {
const { trackhash, duration, source, timestamp } = e.data;
const is_dev = location.port === "5173";
const base_url = is_dev ? "http://localhost:1980" : location.origin;
const url = base_url + "/logger/track/log";
fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ trackhash, duration, source, timestamp }),
});
};