Skip to content

Commit 717d910

Browse files
authored
Update AutogenView.vue to check the object type before using it (#7)
Check the searchFilters type before using the sub functions, ex: forEach
1 parent d3cda20 commit 717d910

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

ui/src/views/AutogenView.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,8 +1997,13 @@ export default {
19971997
},
19981998
onSearch (opts) {
19991999
const query = Object.assign({}, this.$route.query)
2000-
const searchFilters = this.$route?.meta?.searchFilters || []
2001-
searchFilters.forEach(key => delete query[key])
2000+
let searchFilters = this.$route?.meta?.searchFilters || []
2001+
if (typeof searchFilters === 'function') {
2002+
searchFilters = searchFilters()
2003+
}
2004+
if (Array.isArray(searchFilters)) {
2005+
searchFilters.forEach(key => delete query[key])
2006+
}
20022007
delete query.name
20032008
delete query.templatetype
20042009
delete query.keyword

0 commit comments

Comments
 (0)