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

+ 9 - 9
dashboard/src/components/article/AnthologyInfoEdit.tsx

@@ -18,9 +18,9 @@ interface IFormData {
 
 interface IWidget {
   anthologyId?: string;
-  onTitleChange?: Function;
+  onLoad?: Function;
 }
-const AnthologyInfoEditWidget = ({ anthologyId, onTitleChange }: IWidget) => {
+const AnthologyInfoEditWidget = ({ anthologyId, onLoad }: IWidget) => {
   const intl = useIntl();
 
   return anthologyId ? (
@@ -39,8 +39,8 @@ const AnthologyInfoEditWidget = ({ anthologyId, onTitleChange }: IWidget) => {
         );
         console.log(res);
         if (res.ok) {
-          if (typeof onTitleChange !== "undefined") {
-            onTitleChange(res.data.title);
+          if (typeof onLoad !== "undefined") {
+            onLoad(res.data);
           }
           message.success(
             intl.formatMessage({
@@ -52,13 +52,13 @@ const AnthologyInfoEditWidget = ({ anthologyId, onTitleChange }: IWidget) => {
         }
       }}
       request={async () => {
-        const res = await get<IAnthologyResponse>(
-          `/v2/anthology/${anthologyId}`
-        );
+        const url = `/v2/anthology/${anthologyId}`;
+        console.log("url", url);
+        const res = await get<IAnthologyResponse>(url);
         console.log("文集get", res);
         if (res.ok) {
-          if (typeof onTitleChange !== "undefined") {
-            onTitleChange(res.data.title);
+          if (typeof onLoad !== "undefined") {
+            onLoad(res.data);
           }
 
           return {