lang: "",
},
socketCloseListener: null,
- initialize() {
+ initialize(page) {
ajax("/variants", "GET", res => { this.state.variants = res.variantArray; });
let mysid = localStorage["mysid"];
if (!mysid)
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=" + encodeURIComponent(page));
// Settings initialized with values from localStorage
this.state.settings = {
bcolor: localStorage["bcolor"] || "lichess",
};
this.socketCloseListener = () => {
// Next line may fail at first, but should retry and eventually success (TODO?)
- this.state.conn = new WebSocket(params.socketUrl + "/?sid=" + mysid);
+ this.state.conn = new WebSocket(params.socketUrl + "/?sid=" + mysid +
+ "&page=" + encodeURIComponent(page));
};
this.state.conn.onclose = this.socketCloseListener;
const supportedLangs = ["en","es","fr"];