File tree 2 files changed +18
-4
lines changed 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -279,10 +279,20 @@ export const getURLWithSearchParams = (
279
279
}
280
280
281
281
export const getWorkspaces = async (
282
- filter ? : TypesGen . WorkspaceFilter ,
282
+ options : TypesGen . AuditLogsRequest ,
283
283
) : Promise < TypesGen . Workspace [ ] > => {
284
- const url = getURLWithSearchParams ( "/api/v2/workspaces" , filter )
285
- const response = await axios . get < TypesGen . Workspace [ ] > ( url )
284
+ const searchParams = new URLSearchParams ( )
285
+ if ( options . limit ) {
286
+ searchParams . set ( "limit" , options . limit . toString ( ) )
287
+ }
288
+ if ( options . offset ) {
289
+ searchParams . set ( "offset" , options . offset . toString ( ) )
290
+ }
291
+ if ( options . q ) {
292
+ searchParams . set ( "q" , options . q )
293
+ }
294
+
295
+ const response = await axios . get < TypesGen . Workspace [ ] > ( `/api/v2/workspaces?${ searchParams . toString ( ) } ` )
286
296
return response . data
287
297
}
288
298
Original file line number Diff line number Diff line change @@ -418,7 +418,11 @@ export const workspacesMachine =
418
418
} ,
419
419
services : {
420
420
getWorkspaces : ( context ) =>
421
- API . getWorkspaces ( queryToFilter ( context . filter ) ) ,
421
+ API . getWorkspaces ( {
422
+ ...queryToFilter ( context . filter ) ,
423
+ offset : ( context . page - 1 ) * context . limit ,
424
+ limit : context . limit ,
425
+ } ) ,
422
426
updateWorkspaceRefs : ( context , event ) => {
423
427
const refsToKeep : WorkspaceItemMachineRef [ ] = [ ]
424
428
context . workspaceRefs ?. forEach ( ( ref ) => {
You can’t perform that action at this time.
0 commit comments