File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -270,19 +270,22 @@ interface SearchParamOptions extends TypesGen.Pagination {
270
270
271
271
export const getURLWithSearchParams = (
272
272
basePath : string ,
273
- options : SearchParamOptions
273
+ options ? : SearchParamOptions
274
274
) : string => {
275
- const searchParams = new URLSearchParams ( )
276
-
277
- const keys = Object . keys ( options ) as ( keyof SearchParamOptions ) [ ]
278
- keys . forEach ( ( key ) => {
279
- const value = options [ key ] ?? ""
280
- searchParams . append ( key , value . toString ( ) )
281
- } )
282
-
283
- const searchString = searchParams . toString ( )
284
-
285
- return searchString ? `${ basePath } ?${ searchString } ` : basePath
275
+ if ( options ) {
276
+ const searchParams = new URLSearchParams ( )
277
+ const keys = Object . keys ( options ) as ( keyof SearchParamOptions ) [ ]
278
+ keys . forEach ( ( key ) => {
279
+ const value = options [ key ]
280
+ if ( value !== undefined && value !== "" ) {
281
+ searchParams . append ( key , value . toString ( ) )
282
+ }
283
+ } )
284
+ const searchString = searchParams . toString ( )
285
+ return searchString ? `${ basePath } ?${ searchString } ` : basePath
286
+ } else {
287
+ return basePath
288
+ }
286
289
}
287
290
288
291
export const getWorkspaces = async (
You can’t perform that action at this time.
0 commit comments