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