|
|
@@ -1,5 +1,5 @@
|
|
|
import { useState, useEffect } from "react";
|
|
|
-import { ApiFetch } from "../../utils";
|
|
|
+import { get } from "../../request";
|
|
|
import { IApiResponseChapterChannelList } from "../api/Corpus";
|
|
|
import { IParagraph } from "./BookViewer";
|
|
|
import ChapterInChannel, { IChapterChannelData } from "./ChapterInChannel";
|
|
|
@@ -13,26 +13,28 @@ const Widget = (prop: IWidgetPaliChapterChannelList) => {
|
|
|
|
|
|
useEffect(() => {
|
|
|
console.log("palichapterlist useEffect");
|
|
|
- let url = `/progress?view=chapter_channels&book=${prop.para.book}&par=${prop.para.para}`;
|
|
|
- ApiFetch(url).then(function (myJson) {
|
|
|
+ let url = `/v2/progress?view=chapter_channels&book=${prop.para.book}&par=${prop.para.para}`;
|
|
|
+ get(url).then(function (myJson) {
|
|
|
console.log("ajex", myJson);
|
|
|
const data = myJson as unknown as IApiResponseChapterChannelList;
|
|
|
- const newData: IChapterChannelData[] = data.data.rows.map((item) => {
|
|
|
- return {
|
|
|
- channel: {
|
|
|
- ChannelName: item.channel.name,
|
|
|
- ChannelId: item.channel.uid,
|
|
|
- ChannelType: item.channel.type,
|
|
|
- StudioName: "V",
|
|
|
- StudioId: "123",
|
|
|
- StudioType: "p",
|
|
|
- },
|
|
|
- progress: Math.ceil(item.progress * 100),
|
|
|
- hit: item.views,
|
|
|
- like: 0,
|
|
|
- updatedAt: item.updated_at,
|
|
|
- };
|
|
|
- });
|
|
|
+ const newData: IChapterChannelData[] = data.data.rows.map(
|
|
|
+ (item) => {
|
|
|
+ return {
|
|
|
+ channel: {
|
|
|
+ ChannelName: item.channel.name,
|
|
|
+ ChannelId: item.channel.uid,
|
|
|
+ ChannelType: item.channel.type,
|
|
|
+ StudioName: "V",
|
|
|
+ StudioId: "123",
|
|
|
+ StudioType: "p",
|
|
|
+ },
|
|
|
+ progress: Math.ceil(item.progress * 100),
|
|
|
+ hit: item.views,
|
|
|
+ like: 0,
|
|
|
+ updatedAt: item.updated_at,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ );
|
|
|
setTableData(newData);
|
|
|
});
|
|
|
}, [prop.para]);
|