Просмотр исходного кода

打开文章时提交打开记录

visuddhinanda 2 лет назад
Родитель
Сommit
b2a40c0096
1 измененных файлов с 19 добавлено и 3 удалено
  1. 19 3
      dashboard/src/components/article/Article.tsx

+ 19 - 3
dashboard/src/components/article/Article.tsx

@@ -16,11 +16,12 @@ import TocTree from "./TocTree";
 import PaliText from "../template/Wbw/PaliText";
 import ArticleSkeleton from "./ArticleSkeleton";
 
+import { modeChange } from "../../reducers/article-mode";
+import { IViewRequest, IViewStoreResponse } from "../api/view";
 import {
-  IViewRequest,
-  IViewStoreResponse,
+  IRecentRequest,
+  IRecentResponse,
 } from "../../pages/studio/recent/list";
-import { modeChange } from "../../reducers/article-mode";
 
 export type ArticleMode = "read" | "edit" | "wbw";
 export type ArticleType =
@@ -201,6 +202,21 @@ const ArticleWidget = ({
       }
       console.log("article url", url);
       setShowSkeleton(true);
+      if (typeof articleId !== "undefined") {
+        const param = {
+          mode: srcDataMode,
+          channel: channelId !== null ? channelId : undefined,
+          book: book !== null ? book : undefined,
+          para: para !== null ? para : undefined,
+        };
+        post<IRecentRequest, IRecentResponse>("/v2/recent", {
+          type: type,
+          article_id: articleId,
+          param: JSON.stringify(param),
+        }).then((json) => {
+          console.log("recent", json);
+        });
+      }
       get<IArticleResponse>(url)
         .then((json) => {
           console.log("article", json);