X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fstore.js;h=12c756cf29ff828ea7f9540b0fb617a1123a558a;hp=f95e488fd52a7029b1373aa22c8ce3bd35bb4e7d;hb=317b8a5610953b30cfb84382bd13764177ce830b;hpb=6f57a9769ad80459d086abf5232d01ec1ce7a470 diff --git a/client/src/store.js b/client/src/store.js index f95e488f..12c756cf 100644 --- a/client/src/store.js +++ b/client/src/store.js @@ -31,13 +31,20 @@ export const store = }; if (this.state.user.id > 0) { - fetch(params.serverUrl + "/whoami", { - method: "GET", - credentials: params.cors ? "include" : "omit", - }).then((res) => { + ajax("/whoami", "GET", res => { 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); // Settings initialized with values from localStorage