Explorar el Código

提取 grammarTermFetch()

visuddhinanda hace 2 años
padre
commit
1a6026d799
Se han modificado 1 ficheros con 15 adiciones y 8 borrados
  1. 15 8
      dashboard/src/load.ts

+ 15 - 8
dashboard/src/load.ts

@@ -51,6 +51,18 @@ interface INissayaEndingResponse {
     count: number;
     count: number;
   };
   };
 }
 }
+
+export const grammarTermFetch = () => {
+  //获取语法术语表
+  get<ITermResponse>(`/v2/term-vocabulary?view=grammar&lang=` + getLang()).then(
+    (json) => {
+      if (json.ok) {
+        console.debug("grammar dispatch", json.data.rows);
+        store.dispatch(grammar(json.data.rows));
+      }
+    }
+  );
+};
 const init = () => {
 const init = () => {
   get<ISiteInfoResponse | IErrorResponse>("/v2/siteinfo/en").then(
   get<ISiteInfoResponse | IErrorResponse>("/v2/siteinfo/en").then(
     (response) => {
     (response) => {
@@ -97,15 +109,10 @@ const init = () => {
     const json: ISettingItem[] = JSON.parse(setting);
     const json: ISettingItem[] = JSON.parse(setting);
     store.dispatch(refreshSetting(json));
     store.dispatch(refreshSetting(json));
   }
   }
+
   //获取语法术语表
   //获取语法术语表
-  get<ITermResponse>(`/v2/term-vocabulary?view=grammar&lang=` + getLang()).then(
-    (json) => {
-      if (json.ok) {
-        console.debug("grammar dispatch", json.data.rows);
-        store.dispatch(grammar(json.data.rows));
-      }
-    }
-  );
+  grammarTermFetch();
+
   //获取术语表
   //获取术语表
   get<ITermResponse>(
   get<ITermResponse>(
     `/v2/term-vocabulary?view=community&lang=` + getLang()
     `/v2/term-vocabulary?view=community&lang=` + getLang()