@@ -8,14 +8,26 @@ export default {
88 type : "string" ,
99 label : "Worker ID" ,
1010 description : "The ID of the worker" ,
11- async options ( ) {
12- const data = await this . listWorkers ( ) ;
13- return data ?. map ( ( {
14- id : value , personal_info,
15- } ) => ( {
16- label : `${ personal_info . first_name } ${ personal_info . last_name } ` ,
17- value,
18- } ) ) || [ ] ;
11+ async options ( { prevContext } ) {
12+ const args = prevContext ?. next
13+ ? {
14+ url : prevContext ?. next ,
15+ }
16+ : { } ;
17+ const {
18+ results, next_link : next ,
19+ } = await this . listWorkers ( args ) ;
20+ return {
21+ options : results ?. map ( ( {
22+ id : value , personal_info,
23+ } ) => ( {
24+ label : `${ personal_info . first_name } ${ personal_info . last_name } ` ,
25+ value,
26+ } ) ) || [ ] ,
27+ context : {
28+ next,
29+ } ,
30+ } ;
1931 } ,
2032 } ,
2133 teamId : {
@@ -25,7 +37,7 @@ export default {
2537 async options ( { prevContext } ) {
2638 const args = prevContext ?. next
2739 ? {
28- url : next ,
40+ url : prevContext ?. next ,
2941 }
3042 : { } ;
3143 const {
@@ -51,7 +63,7 @@ export default {
5163 async options ( { prevContext } ) {
5264 const args = prevContext ?. next
5365 ? {
54- url : next ,
66+ url : prevContext ?. next ,
5567 }
5668 : { } ;
5769 const {
@@ -77,7 +89,7 @@ export default {
7789 async options ( { prevContext } ) {
7890 const args = prevContext ?. next
7991 ? {
80- url : next ,
92+ url : prevContext ?. next ,
8193 }
8294 : { } ;
8395 const {
@@ -237,9 +249,9 @@ export default {
237249 if ( max && ++ count >= max ) {
238250 return ;
239251 }
240- hasMore = next ;
241- args . url = next ;
242252 }
253+ hasMore = next ;
254+ args . url = next ;
243255 } while ( hasMore ) ;
244256 } ,
245257 async getPaginatedResources ( opts ) {
0 commit comments