visuddhinanda 2 ani în urmă
părinte
comite
9fb91b0fb8
1 a modificat fișierele cu 28 adăugiri și 0 ștergeri
  1. 28 0
      dashboard/src/components/corpus/PrPull.tsx

+ 28 - 0
dashboard/src/components/corpus/PrPull.tsx

@@ -0,0 +1,28 @@
+import { useEffect } from "react";
+import { get } from "../../request";
+import { ISuggestionResponse } from "../api/Suggestion";
+import store from "../../store";
+import { refresh } from "../../reducers/pr-load";
+
+interface IWidget {
+  uid?: string | null;
+}
+const PrPullWidget = ({ uid }: IWidget) => {
+  useEffect(() => {
+    if (!uid) {
+      return;
+    }
+    const url = `/v2/sentpr/${uid}`;
+    console.log("url", url);
+    get<ISuggestionResponse>(url)
+      .then((json) => {
+        if (json.ok) {
+          store.dispatch(refresh(json.data));
+        }
+      })
+      .catch((e) => console.error(e));
+  }, [uid]);
+  return <></>;
+};
+
+export default PrPullWidget;