Fixes user metadata type not fetching all values due to pagination.

This commit is contained in:
mateuswetah 2024-10-07 15:55:50 -03:00
parent 0e16445141
commit 1a6128c01b
1 changed files with 6 additions and 2 deletions

View File

@ -107,10 +107,14 @@ export default {
this.$emit('blur');
},
loadCurrentUsers() {
if ((Array.isArray(this.itemMetadatum.value) && this.itemMetadatum.value.length) || (!Array.isArray(this.itemMetadatum.value) && this.itemMetadatum.value)) {
if (
(Array.isArray(this.itemMetadatum.value) && this.itemMetadatum.value.length) ||
(!Array.isArray(this.itemMetadatum.value) && this.itemMetadatum.value)
) {
this.isLoading = true;
let query = qs.stringify({ include: this.itemMetadatum.value });
let perPage = isNaN(this.itemMetadatum.value) ? this.itemMetadatum.value.length + 1 : 100;
let query = qs.stringify({ include: this.itemMetadatum.value, per_page: perPage });
let endpoint = '/users/';
wpApi.get(endpoint + '?' + query)