Repos / pytaku / 8199a82f83
commit 8199a82f8370cdbceaf7a4af6550f8689a9a9f9b
Author: Bùi Thành Nhân <hi@imnhan.com>
Date:   Sun Aug 23 23:29:00 2020 +0700

    only call "read" API when logged in

diff --git a/pyproject.toml b/pyproject.toml
index da61574..fbdb802 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "pytaku"
-version = "0.3.0"
+version = "0.3.1"
 description = ""
 authors = ["Bùi Thành Nhân <hi@imnhan.com>"]
 license = "AGPL-3.0-only"
diff --git a/src/pytaku/static/js/routes/chapter.js b/src/pytaku/static/js/routes/chapter.js
index b22a2d7..16dad27 100644
--- a/src/pytaku/static/js/routes/chapter.js
+++ b/src/pytaku/static/js/routes/chapter.js
@@ -111,19 +111,21 @@ function Chapter(initialVNode) {
               ? `/m/${site}/${titleId}/${next.id}`
               : `/m/${site}/${titleId}`,
             onclick: (ev) => {
-              Auth.request({
-                method: "POST",
-                url: "/api/read",
-                body: {
-                  read: [
-                    {
-                      site,
-                      title_id: titleId,
-                      chapter_id: chapter.id,
-                    },
-                  ],
-                },
-              });
+              if (Auth.isLoggedIn()) {
+                Auth.request({
+                  method: "POST",
+                  url: "/api/read",
+                  body: {
+                    read: [
+                      {
+                        site,
+                        title_id: titleId,
+                        chapter_id: chapter.id,
+                      },
+                    ],
+                  },
+                });
+              }
               return true;
             },
           },