Explorar el Código

修改框架接口默认超时时间为2分钟

zyf hace 1 mes
padre
commit
870e34ea19
Se han modificado 1 ficheros con 5 adiciones y 5 borrados
  1. 5 5
      src/components/App.tsx

+ 5 - 5
src/components/App.tsx

@@ -54,7 +54,7 @@ function App() {
 
   const loadApiList = useCallback(async () => {
     try {
-      const list = await Dingdocs.script.run('getApiList');
+      const list = await Dingdocs.script.runWithTimeout('getApiList', 120000);
       setApiList(list);
     } catch (error: any) {
       console.error('加载 API 列表失败:', error);
@@ -102,10 +102,10 @@ function App() {
       const authResult = await Dingdocs.base.host.getAuthCode(corpId);
       const authCode = authResult.code;
       
-      const user = await Dingdocs.script.run('login', authCode);
+      const user = await Dingdocs.script.runWithTimeout('login', 120000, authCode);
       setUserInfo(user);
       
-      const token = await Dingdocs.script.run('getToken');
+      const token = await Dingdocs.script.runWithTimeout('getToken', 120000);
       await handleConfigPermission(token);
     } catch (error: any) {
       console.error('自动登录失败:', error);
@@ -116,7 +116,7 @@ function App() {
 
   const loadDocumentInfo = useCallback(async () => {
     try {
-      const info = await Dingdocs.script.run('getDocumentInfo');
+      const info = await Dingdocs.script.runWithTimeout('getDocumentInfo', 120000);
       setCustomTableId(info?.uuid || '');
       setCustomTableName(info?.currentSheet || '');
     } catch (error: any) {
@@ -165,7 +165,7 @@ function App() {
     };
     
     try {
-      const response: ApiResponse = await Dingdocs.script.run('callApi', apiItem);
+      const response: ApiResponse = await Dingdocs.script.runWithTimeout('callApi', 120000, apiItem);
       setResult(JSON.stringify(response, null, 2));
     } catch (error: any) {
       setResult(`调用失败: ${error.message}`);