X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fstore.js;h=3b280d942ce39e82e3306596b87cb492ed83e879;hp=12c756cf29ff828ea7f9540b0fb617a1123a558a;hb=5f13148449c73de92993b7961c077167563b84e5;hpb=92a523d1a74cbabcfd7d6ade45f25fa622815f0b diff --git a/client/src/store.js b/client/src/store.js index 12c756cf..3b280d94 100644 --- a/client/src/store.js +++ b/client/src/store.js @@ -14,7 +14,7 @@ export const store = lang: "", }, socketCloseListener: null, - initialize() { + initialize(page) { ajax("/variants", "GET", res => { this.state.variants = res.variantArray; }); let mysid = localStorage["mysid"]; if (!mysid) @@ -35,18 +35,9 @@ export const store = this.state.user.email = res.email; this.state.user.notify = res.notify; }); - // TODO: fetch is simpler, but does not set req.xhr (for security check) -// fetch(params.serverUrl + "/whoami", { -// method: "GET", -// credentials: params.cors ? "include" : "omit", -// }).then((res) => { -// return res.json() -// }).then((user) => { -// this.state.user.email = user.email; -// this.state.user.notify = user.notify; -// }); } - this.state.conn = new WebSocket(params.socketUrl + "/?sid=" + mysid); + this.state.conn = new WebSocket( + params.socketUrl + "/?sid=" + mysid + "&page=" + page); // Settings initialized with values from localStorage this.state.settings = { bcolor: localStorage["bcolor"] || "lichess",