diff --git a/chat2db-client/src/components/ConsoleEditor/components/SelectBoundInfo/index.tsx b/chat2db-client/src/components/ConsoleEditor/components/SelectBoundInfo/index.tsx index 0d60b818..0e9ddaed 100644 --- a/chat2db-client/src/components/ConsoleEditor/components/SelectBoundInfo/index.tsx +++ b/chat2db-client/src/components/ConsoleEditor/components/SelectBoundInfo/index.tsx @@ -105,6 +105,9 @@ const SelectBoundInfo = memo((props: IProps) => { // 获取数据库列表 const getDatabaseList = () => { + if(boundInfo.dataSourceId === undefined || boundInfo.dataSourceId === null){ + return + } connectionService .getDatabaseList({ dataSourceId: boundInfo.dataSourceId, @@ -131,8 +134,8 @@ const SelectBoundInfo = memo((props: IProps) => { // 获取schema列表 const getSchemaList = () => { - if (boundInfo.databaseName === null || boundInfo.databaseName === undefined) { - return; + if(boundInfo.dataSourceId === undefined || boundInfo.dataSourceId === null){ + return } connectionService .getSchemaList({ diff --git a/chat2db-client/src/service/connection.ts b/chat2db-client/src/service/connection.ts index 1366d618..91aa4447 100644 --- a/chat2db-client/src/service/connection.ts +++ b/chat2db-client/src/service/connection.ts @@ -59,7 +59,7 @@ const getDatabaseList = createRequest<{ dataSourceId: number; refresh?: boolean method: 'get', }); -const getSchemaList = createRequest<{ dataSourceId: number; databaseName: string; refresh?: boolean }, any>( +const getSchemaList = createRequest<{ dataSourceId: number; databaseName?: string; refresh?: boolean }, any>( '/api/rdb/schema/list', { method: 'get' }, );