Sfoglia il codice sorgente

add parentStudioId parentChannelId

visuddhinanda 2 anni fa
parent
commit
362a581224
1 ha cambiato i file con 17 aggiunte e 2 eliminazioni
  1. 17 2
      dashboard/src/components/term/TermModal.tsx

+ 17 - 2
dashboard/src/components/term/TermModal.tsx

@@ -1,6 +1,7 @@
 import { useState } from "react";
 import { Modal } from "antd";
 import TermEdit from "./TermEdit";
+import { ITermDataResponse } from "../api/Term";
 
 interface IWidget {
   trigger?: React.ReactNode;
@@ -8,7 +9,10 @@ interface IWidget {
   word?: string;
   studioName?: string;
   channelId?: string;
+  parentChannelId?: string;
+  parentStudioId?: string;
   onUpdate?: Function;
+  onClose?: Function;
 }
 const TermModalWidget = ({
   trigger,
@@ -16,7 +20,10 @@ const TermModalWidget = ({
   word,
   studioName,
   channelId,
+  parentChannelId,
+  parentStudioId,
   onUpdate,
+  onClose,
 }: IWidget) => {
   const [isModalOpen, setIsModalOpen] = useState(false);
 
@@ -26,10 +33,16 @@ const TermModalWidget = ({
 
   const handleOk = () => {
     setIsModalOpen(false);
+    if (typeof onClose !== "undefined") {
+      onClose();
+    }
   };
 
   const handleCancel = () => {
     setIsModalOpen(false);
+    if (typeof onClose !== "undefined") {
+      onClose();
+    }
   };
 
   return (
@@ -49,10 +62,12 @@ const TermModalWidget = ({
           word={word}
           studioName={studioName}
           channelId={channelId}
-          onUpdate={() => {
+          parentChannelId={parentChannelId}
+          parentStudioId={parentStudioId}
+          onUpdate={(value: ITermDataResponse) => {
             setIsModalOpen(false);
             if (typeof onUpdate !== "undefined") {
-              onUpdate();
+              onUpdate(value);
             }
           }}
         />