Преглед на файлове

更新后push到全局术语表

visuddhinanda преди 2 години
родител
ревизия
a5ceff3742
променени са 1 файла, в които са добавени 5 реда и са изтрити 0 реда
  1. 5 0
      dashboard/src/components/term/TermEdit.tsx

+ 5 - 0
dashboard/src/components/term/TermEdit.tsx

@@ -32,6 +32,8 @@ import { get, post, put } from "../../request";
 import MDEditor from "@uiw/react-md-editor";
 import MDEditor from "@uiw/react-md-editor";
 import { useAppSelector } from "../../hooks";
 import { useAppSelector } from "../../hooks";
 import { currentUser as _currentUser } from "../../reducers/current-user";
 import { currentUser as _currentUser } from "../../reducers/current-user";
+import store from "../../store";
+import { push } from "../../reducers/term-vocabulary";
 
 
 interface ValueType {
 interface ValueType {
   key?: string;
   key?: string;
@@ -192,6 +194,9 @@ const TermEditWidget = ({
 
 
           if (res.ok) {
           if (res.ok) {
             message.success("提交成功");
             message.success("提交成功");
+            store.dispatch(
+              push({ word: res.data.word, meaning: res.data.meaning })
+            );
             if (typeof onUpdate !== "undefined") {
             if (typeof onUpdate !== "undefined") {
               onUpdate(res.data);
               onUpdate(res.data);
             }
             }