Skip to content

Commit f0f6d9b

Browse files
committed
fix: config data null exception
1 parent f784dbc commit f0f6d9b

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/pages/project/$db/db.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,16 @@ class DatabaseDetail extends PureComponent {
171171
const { projectDetail } = this.props
172172
const { table_names, tables } = projectDetail
173173

174+
const number_of_tables =
175+
(Object.keys(tables) && Object.keys(tables).length) || 0
176+
174177
return (
175178
<Page inner>
176179
<div className={styles.tables}>
177180
<div className={styles.title}>
178181
<Trans>Table Details:</Trans>
179182
</div>
180-
{Object.keys(tables).length !== 0 ? (
183+
{number_of_tables !== 0 ? (
181184
table_names.map(name => (
182185
<div key={name} className={styles.table}>
183186
<div className={styles.tableName}>

src/pages/project/$db/models/detail.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export default {
147147

148148
const { data, success } = yield call(queryProjectTables, _payload)
149149
if (success) {
150+
if (!data.tables) return
150151
yield put({
151152
type: 'updateState',
152153
payload: {

src/pages/project/$db/request.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ class RequestPage extends React.Component {
7373
}
7474

7575
constructAPIDomain = () => {
76-
const alias = _get(this.props.config, ['misc', 'alias'], '')
77-
return '//' + alias + '.stg-api.covenantsql.io:15153'
76+
const api_domain = _get(this.props.config, ['client_api_domains', 0])
77+
return '//' + api_domain
7878
}
7979

8080
constructTableSelection = () => {
81-
const tables = _get(this.props.config, ['tables'], [])
81+
const tables = _get(this.props.config, ['tables']) || []
8282
return (
8383
<Select placeholder="Select a table" style={{ minWidth: '160px' }}>
8484
{tables.map(t => {

0 commit comments

Comments
 (0)