Skip to content

Commit

Permalink
fix: use .? instead of if
Browse files Browse the repository at this point in the history
  • Loading branch information
vbrvk committed Mar 11, 2024
1 parent 3a19930 commit f9a2c68
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,14 @@ export class Api {
},
sort?: SortKey
): Promise<LimitOrderApiItem[]> {
const params = {} as Record<string, string>

if (filters) {
if (filters.pager) {
params.limit = filters.pager.limit.toString()
params.page = filters.pager.page.toString()
}

if (filters.statuses) {
params.statuses = filters.statuses.join(',')
}

if (filters.makerAsset) {
params.makerAsset = filters.makerAsset.toString()
}

if (filters.takerAsset) {
params.takerAsset = filters.takerAsset.toString()
}
}

if (sort) {
params.sortBy = sort
}
const params = {
limit: filters?.pager?.limit.toString(),
page: filters?.pager?.page.toString(),
statuses: filters?.statuses?.join(','),
makerAsset: filters?.makerAsset?.toString(),
takerAsset: filters?.takerAsset?.toString(),
sortBy: sort
} as Record<string, string>

return this.httpClient.get(
this.url(`/address/${maker}`, params),
Expand Down

0 comments on commit f9a2c68

Please sign in to comment.