Skip to content

Commit 17532a0

Browse files
committed
Fix undefined search
1 parent 8ad5ddc commit 17532a0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

generator/templates/Crud/src/components/Resource.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,19 @@ export default {
131131
sorting.sortBy = sortBy[0];
132132
sorting.desc = sortDesc[0] ? 1 : 0;
133133
}
134+
135+
const params = {
136+
page: page,
137+
perPage: itemsPerPage,
138+
...sorting,
139+
};
140+
141+
if (search) {
142+
params.search = search;
143+
}
144+
134145
axios.get(this.resourceUri, {
135-
params: {
136-
search: search || undefined,
137-
page: page,
138-
perPage: itemsPerPage,
139-
...sorting,
140-
},
146+
params: params,
141147
})
142148
.then((response) => {
143149
const items = this.mapDataResponse(response.data.data);

0 commit comments

Comments
 (0)