Experimental news notification system + fix Eightpieces variant
[vchess.git] / client / src / store.js
index 76210ee..792d2a5 100644 (file)
@@ -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) => {