Skip to content

Commit c07da93

Browse files
ZePan110alexsin368
authored andcommitted
DBQnA: Unified POST data format, and fix judgment logic. (opea-project#2153)
Signed-off-by: ZePan110 <ze.pan@intel.com> Signed-off-by: alexsin368 <alex.sin@intel.com>
1 parent 3c7b980 commit c07da93

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

DBQnA/ui/react/src/components/DbConnect/DBConnect.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const DBConnect: React.FC = () => {
99
const [formData, setFormData] = useState({
1010
user: 'postgres',
1111
database: 'chinook',
12-
host: '10.223.24.113',
12+
host: '127.0.0.1',
1313
password: 'testpwd',
1414
port: '5442',
1515
});
@@ -42,12 +42,13 @@ const DBConnect: React.FC = () => {
4242
e.preventDefault();
4343
try {
4444
let api_response: Record<string, any>;
45-
api_response = await axios.post(`${TEXT_TO_SQL_URL}/postgres/health`, formData);
45+
let unifiedConnData = {"conn_str":formData};
46+
api_response = await axios.post(`${TEXT_TO_SQL_URL}/postgres/health`, unifiedConnData);
4647

4748
setSqlStatus(null);
4849
setSqlError(null);
4950

50-
if (api_response.data.status === 'success') {
51+
if (api_response.data.status && api_response.data.status.toLowerCase().includes('success')) {
5152
setDbStatus(api_response.data.message);
5253
setDbError(null);
5354
setIsConnected(true);

0 commit comments

Comments
 (0)