Skip to content

Commit e9f74cd

Browse files
axshaniilyamerman
andauthored
using customStringify (#437)
* JSON.stringify to send objects * remove console.log * longitude and latitude could be a string representing a number * test address * using this.customStringify * lint-fix --------- Co-authored-by: Ilya Merman <[email protected]>
1 parent 06a08ff commit e9f74cd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

resources/atmLocations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export class AtmLocations extends BaseResource {
1010

1111
public async list(params?: AtmLocationListParams): Promise<UnitResponse<AtmLocation[]>> {
1212
const parameters = {
13-
...(params?.coordinates && { "filter[coordinates]": JSON.stringify(params.coordinates) }),
14-
...(params?.address && { "filter[address]": JSON.stringify(params.address) }),
13+
...(params?.coordinates && { "filter[coordinates]": this.customStringify(params.coordinates) }),
14+
...(params?.address && { "filter[address]": this.customStringify(params.address) }),
1515
...(params?.postalCode && { "filter[postalCode]": params.postalCode }),
1616
...(params?.searchRadius && { "filter[searchRadius]": params.searchRadius })
1717
}

resources/baseResource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class BaseResource {
131131
return configHeaders ? { ...this.headers, ...configHeaders } : this.headers
132132
}
133133

134-
protected customStringify(obj:any , separator: string) {
134+
protected customStringify(obj:any , separator = ":") {
135135
return "{" + Object.keys(obj)
136136
.map(key => `"${key}"${separator}"${obj[key]}"`)
137137
.join(", ") + "}"

0 commit comments

Comments
 (0)