Utility functions for API requests and query string handling
Members
# static constant getJson
Makes a GET request to an API endpoint and parses the JSON response
Example
const data = await getJson<UserData>('/api/user', { id: 123 });
Methods
# inner buildQueryString(params) → {string}
Builds a query string from an object of key-value pairs
Parameters:
Name | Type | Description |
---|---|---|
params |
Record.<string, any>
|
Object containing query parameters |
Formatted query string without the leading '?'
string
Example
buildQueryString({ lat: 123, lng: 456 }) // returns "lat=123&lng=456"