1 const appendQueryParams = (url: URL, params: { [key: string]: any }) => {
2 Object.keys(params).forEach((key) => {
3 const value = params[key];
4 if (typeof value === 'undefined') {
7 url.searchParams.append(key, value);
11 export const createUrl = (urlString: string, params: { [key: string]: any } = {}, origin?: string) => {
14 url = new URL(urlString, origin);
16 url = new URL(urlString);
18 appendQueryParams(url, params);
22 export const getDateHeader = (headers: Headers) => {
23 const dateHeader = headers?.get?.('date');
27 const newServerTime = new Date(dateHeader);
28 if (Number.isNaN(+newServerTime)) {