Skip to content

Commit e85cc07

Browse files
committed
#39 #40 fix display of erroneous empty cve record; display server error if response.data is not an object
1 parent 33bae16 commit e85cc07

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/cveRecordLookupModule.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,16 @@ export default ({
143143
axios
144144
.get(url, { timeout: 30000 })
145145
.then((res) => {
146+
const response = res;
146147
this.$store.commit('updateState', { showHelpText: false });
147148
this.$store.commit('updateState', { isSearching: false });
148149
149-
if (res.status === 200 && Object.keys(res.data).length > 0) {
150-
if (Object.prototype.hasOwnProperty.call(res.data, 'error')) {
150+
if (response.status === 200 && typeof response.data === 'object') {
151+
if (Object.prototype.hasOwnProperty.call(response.data, 'error')) {
151152
self.$store.commit('updateState', { error: true });
152153
}
153154
154-
this.handleCveRecordDisplay(res.data);
155+
this.handleCveRecordDisplay(response.data);
155156
} else {
156157
this.handleServerError();
157158
}

0 commit comments

Comments
 (0)