I am trying to retrieve data with pagination, but its not returning the value.
export default async function fetchData() {
let data = []
base('table-name-here')
.select({
pageSize: 3,
view: 'Grid view',
})
.eachPage(
function page(records, fetchNextPage) {
data = [...data, ...records]
// fetchNextPage();
console.log(data) // this shows result as expected
return data // this doesn't work
},
function done(err) {
if (err) {
console.error(err)
return
}
}
)
}
when I call this function from frontend I can see the values from console.log statement, but it doesn’t return the data array.