Skip to content

Commit 6a7d195

Browse files
committed
Refactor code to use optional chaining for accessing nested properties
1 parent 55d0318 commit 6a7d195

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/components/identityForm/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async function submit() {
7676
});
7777
if (error.value) {
7878
console.log('error', error.value.data.validations)
79-
validations.value = error.value.data.validations
79+
validations.value = { ...error.value.data.validations }
8080
// error.value = error.value.cause.response._data
8181
handleError({
8282
error: error.value,
@@ -90,7 +90,7 @@ async function submit() {
9090
position: 'top-right',
9191
icon: 'mdi-check-circle-outline',
9292
})
93-
emits('refreshTarget', result.value.data)
93+
emits('refreshTarget', { ...result.value.data })
9494
}
9595
}
9696

src/components/searchfilters/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const getAllPrefixAndSuffixPattern = computed(() => {
8383
const optionsRegrouped = (): { name: string; label: { label: string; value: string }[]; type: string }[] => {
8484
// Initialize an empty object to store the results
8585
const result: { [key: string]: { label: string; value: string }[] } = {}
86-
const options = mainData.value?.rightSelect.options ?? []
86+
const options = mainData.value?.rightSelect?.options ?? []
8787
for (const item of options) {
8888
if (!item.header && item.group) {
8989
if (!result[item.group]) {
@@ -166,7 +166,7 @@ const extractComparator = (
166166
comparator: string
167167
field: string
168168
} | null => {
169-
const match = key.match(/^(\=|\?|\#|\!|\>|\<|\^|\@)+/)
169+
const match = key.match(/^(\:|\?|\#|\!|\>|\<|\^|\@)+/)
170170
if (!match) return null
171171
const comparator = match[0]
172172
const field = key.replace(comparator, '')

0 commit comments

Comments
 (0)