Browse Source

支持 channels

visuddhinanda 2 năm trước cách đây
mục cha
commit
5f9c6aad59

+ 4 - 2
dashboard/src/components/anthology/AnthologyTocTree.tsx

@@ -1,5 +1,4 @@
 import { useEffect, useState } from "react";
 import { useEffect, useState } from "react";
-import { useNavigate } from "react-router-dom";
 
 
 import { get } from "../../request";
 import { get } from "../../request";
 import { IArticleMapListResponse } from "../api/Article";
 import { IArticleMapListResponse } from "../api/Article";
@@ -8,11 +7,13 @@ import TocTree from "../article/TocTree";
 
 
 interface IWidget {
 interface IWidget {
   anthologyId?: string;
   anthologyId?: string;
+  channels?: string[];
   onSelect?: Function;
   onSelect?: Function;
   onArticleSelect?: Function;
   onArticleSelect?: Function;
 }
 }
 const AnthologyTocTreeWidget = ({
 const AnthologyTocTreeWidget = ({
   anthologyId,
   anthologyId,
+  channels,
   onSelect,
   onSelect,
   onArticleSelect,
   onArticleSelect,
 }: IWidget) => {
 }: IWidget) => {
@@ -23,7 +24,8 @@ const AnthologyTocTreeWidget = ({
     if (typeof anthologyId === "undefined") {
     if (typeof anthologyId === "undefined") {
       return;
       return;
     }
     }
-    const url = `/v2/article-map?view=anthology&id=${anthologyId}`;
+    let url = `/v2/article-map?view=anthology&id=${anthologyId}`;
+    url += channels && channels.length > 0 ? "&channel=" + channels[0] : "";
     console.log("url", url);
     console.log("url", url);
     get<IArticleMapListResponse>(url).then((json) => {
     get<IArticleMapListResponse>(url).then((json) => {
       if (json.ok) {
       if (json.ok) {