OpenSlides/client/src/app/core/query-params.ts
Sean Engelhardt 0c62c1c864 History mode on client side
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
2018-11-30 12:42:13 +01:00

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;
}