Hi people!
I’m trying to use the wix-data API to query the Blog/Posts database.
However, I’m unable to use the next() function properly. According to the function’s description, it is supposed to skip the pageSize set by limit().
This is the code I’m using:
if ( postResults == undefined ) { let categoryID = getCategoryID ( category );
I don’t know if your promise timing is correct.
Maybe it gets the results of the .prev() before the .next() and overrides the first results. You should carefully handle the promises.
Anyway you should handle the promises because the way you did it (assuming that you posted the code as is) is incorrect. But I guess you only posted some parts of the code which makes it hard to understand.
@jonatandor35 Hi, doing some further tests, even if I add an ‘else’ after the if (direction == “up”) check (now if ( direction == directionEnum . NEXT ) ) it still skips 3 rather than 6.
export async function getPostData ( category , offset , length ) { if ( postResults == undefined ) { let categoryID = getCategoryID ( category );