0c62c1c864
Add view for full history and History Repom TimeTravelService Add function time travel routine Updated the HTTP Service, fixed usage of storage, OSStatus Service, fixed loading of the history data
31 lines
740 B
TypeScript
31 lines
740 B
TypeScript
|
|
type QueryParamValue = string | number | boolean;
|
|
|
|
/**
|
|
* A key value mapping for params, that should be appended to the url on a new connection.
|
|
*/
|
|
export interface QueryParams {
|
|
[key: string]: QueryParamValue;
|
|
}
|
|
|
|
/**
|
|
* Formats query params for the url.
|
|
*
|
|
* @param queryParams
|
|
* @returns the formatted query params as string
|
|
*/
|
|
export function formatQueryParams(queryParams: QueryParams = {}): string {
|
|
let params = '';
|
|
const keys: string[] = Object.keys(queryParams);
|
|
if (keys.length > 0) {
|
|
params =
|
|
'?' +
|
|
keys
|
|
.map(key => {
|
|
return key + '=' + queryParams[key].toString();
|
|
})
|
|
.join('&');
|
|
}
|
|
return params;
|
|
}
|