Remove conditional spreading

This commit is contained in:
James Deacon 2022-01-17 19:58:02 +00:00
parent 12a741db39
commit a0c45d9da4

View file

@ -64,15 +64,18 @@ Tools.connect = function () {
var url = new URL(window.location); var url = new URL(window.location);
var params = new URLSearchParams(url.search); var params = new URLSearchParams(url.search);
var token = params.get("token");
this.socket = io.connect('', { var socket_params = {
...(token && {"query" : "token=" + token}),
"path": window.location.pathname.split("/boards/")[0] + "/socket.io", "path": window.location.pathname.split("/boards/")[0] + "/socket.io",
"reconnection": true, "reconnection": true,
"reconnectionDelay": 100, //Make the xhr connections as fast as possible "reconnectionDelay": 100, //Make the xhr connections as fast as possible
"timeout": 1000 * 60 * 20 // Timeout after 20 minutes "timeout": 1000 * 60 * 20 // Timeout after 20 minutes
}); }
if(params.has("token")) {
socket_params.query = "token=" + params.get("token");
}
this.socket = io.connect('', socket_params);
//Receive draw instructions from the server //Receive draw instructions from the server
this.socket.on("broadcast", function (msg) { this.socket.on("broadcast", function (msg) {