Improve validation around loading options for relationship field

This commit is contained in:
Andrew Kingston 2021-02-01 13:23:18 +00:00
parent b65673b77a
commit b1c82626d9
1 changed files with 6 additions and 2 deletions

View File

@ -25,13 +25,17 @@
const fetchTable = async id => { const fetchTable = async id => {
if (id != null) { if (id != null) {
tableDefinition = await API.fetchTableDefinition(id) const result = await API.fetchTableDefinition(id)
if (!result.error) {
tableDefinition = result
}
} }
} }
const fetchRows = async id => { const fetchRows = async id => {
if (id != null) { if (id != null) {
options = await API.fetchTableData(id) const rows = await API.fetchTableData(id)
options = rows && !rows.error ? rows : []
} }
} }