X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fstore.js;h=792d2a5b2a7f3eb59ab94cdbab327eba28545ca3;hb=d9a7a1e40254bda6e545514596a7363048c084f9;hp=668f999d3af77aa2c99f8291154ddab7b35fd2de;hpb=e57c4de4148d43e7635e09adcde4e56585aea303;p=vchess.git diff --git a/client/src/store.js b/client/src/store.js index 668f999d..792d2a5b 100644 --- a/client/src/store.js +++ b/client/src/store.js @@ -30,8 +30,8 @@ export const store = { alert("Variants loading failed: reload the page"); return; } - this.state.variants = json.variantArray.sort( - (v1,v2) => v1.name.localeCompare(v2.name)); + this.state.variants = json.variantArray + .sort((v1,v2) => v1.name.localeCompare(v2.name)); }); let mysid = localStorage.getItem("mysid"); // Assign mysid only once (until next time user clear browser data) @@ -45,6 +45,7 @@ export const store = { name: localStorage.getItem("myname") || "", //"" for "anonymous" email: "", //unknown yet notify: false, //email notifications + newsRead: localStorage.getItem("newsRead") || 0, sid: mysid }; // Slow verification through the server: @@ -77,6 +78,8 @@ export const store = { localStorage.removeItem("myname"); this.state.user.email = json.email; this.state.user.notify = json.notify; + if (!!json.newsRead && json.newsRead > this.state.user.newsRead) + this.state.user.newsRead = json.newsRead; }); // Settings initialized with values from localStorage const getItemDefaultTrue = (item) => {