All files / platform/app/src/utils preserveQueryParameters.ts

80% Statements 8/10
50% Branches 2/4
100% Functions 3/3
80% Lines 8/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  8624x 8624x         55x           2156x 8624x         1x 4x 4x          
function preserve(query, current, key) {
  const value = current.get(key);
  Iif (value) {
    query.append(key, value);
  }
}
 
export const preserveKeys = ['configUrl', 'multimonitor', 'screenNumber', 'hangingProtocolId'];
 
export function preserveQueryParameters(
  query,
  current = new URLSearchParams(window.location.search)
) {
  for (const key of preserveKeys) {
    preserve(query, current, key);
  }
}
 
export function preserveQueryStrings(query, current = new URLSearchParams(window.location.search)) {
  for (const key of preserveKeys) {
    const value = current.get(key);
    Iif (value) {
      query[key] = value;
    }
  }
}